Skip to content

Commit 9d12219

Browse files
author
MomIsBestFriend
committed
Replaced "Hashable" with "Label" form pandas._typing
As WillAyd suggested
1 parent 71bbbca commit 9d12219

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

pandas/io/formats/excel.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
1-
"""Utilities for conversion to writer-agnostic Excel representation
1+
"""
2+
Utilities for conversion to writer-agnostic Excel representation.
23
"""
34

45
from functools import reduce
56
import itertools
67
import re
7-
from typing import Callable, Dict, Hashable, Optional, Sequence, Union
8+
from typing import Callable, Dict, Optional, Sequence, Union
89
import warnings
910

1011
import numpy as np
1112

13+
from pandas._typing import Label
14+
1215
from pandas.core.dtypes import missing
1316
from pandas.core.dtypes.common import is_float, is_scalar
1417
from pandas.core.dtypes.generic import ABCMultiIndex, ABCPeriodIndex
@@ -371,10 +374,10 @@ def __init__(
371374
df,
372375
na_rep: str = "",
373376
float_format: Optional[str] = None,
374-
cols: Optional[Sequence[Hashable]] = None,
375-
header: Union[Sequence[Hashable], bool] = True,
377+
cols: Optional[Sequence[Label]] = None,
378+
header: Union[Sequence[Label], bool] = True,
376379
index: bool = True,
377-
index_label: Optional[Union[Hashable, Sequence[Hashable]]] = None,
380+
index_label: Optional[Union[Label, Sequence[Label]]] = None,
378381
merge_cells: bool = False,
379382
inf_rep: str = "inf",
380383
style_converter: Optional[Callable] = None,

pandas/io/formats/style.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
Callable,
1313
DefaultDict,
1414
Dict,
15-
Hashable,
1615
List,
1716
Optional,
1817
Sequence,
@@ -26,7 +25,7 @@
2625
from pandas._config import get_option
2726

2827
from pandas._libs import lib
29-
from pandas._typing import Axis, FrameOrSeries, FrameOrSeriesUnion
28+
from pandas._typing import Axis, FrameOrSeries, FrameOrSeriesUnion, Label
3029
from pandas.compat._optional import import_optional_dependency
3130
from pandas.util._decorators import Appender
3231

@@ -210,10 +209,10 @@ def to_excel(
210209
sheet_name: str = "Sheet1",
211210
na_rep: str = "",
212211
float_format: Optional[str] = None,
213-
columns: Optional[Sequence[Hashable]] = None,
214-
header: Union[Sequence[Hashable], bool] = True,
212+
columns: Optional[Sequence[Label]] = None,
213+
header: Union[Sequence[Label], bool] = True,
215214
index: bool = True,
216-
index_label: Optional[Union[Hashable, Sequence[Hashable]]] = None,
215+
index_label: Optional[Union[Label, Sequence[Label]]] = None,
217216
startrow: int = 0,
218217
startcol: int = 0,
219218
engine: Optional[str] = None,

0 commit comments

Comments
 (0)