61
61
FrameOrSeriesUnion ,
62
62
IndexKeyFunc ,
63
63
IndexLabel ,
64
- Label ,
65
64
Level ,
66
65
PythonFuncType ,
67
66
Renamer ,
@@ -992,7 +991,7 @@ def style(self) -> Styler:
992
991
"""
993
992
994
993
@Appender (_shared_docs ["items" ])
995
- def items (self ) -> Iterable [Tuple [Label , Series ]]:
994
+ def items (self ) -> Iterable [Tuple [Hashable , Series ]]:
996
995
if self .columns .is_unique and hasattr (self , "_item_cache" ):
997
996
for k in self .columns :
998
997
yield k , self ._get_item_cache (k )
@@ -1001,10 +1000,10 @@ def items(self) -> Iterable[Tuple[Label, Series]]:
1001
1000
yield k , self ._ixs (i , axis = 1 )
1002
1001
1003
1002
@Appender (_shared_docs ["items" ])
1004
- def iteritems (self ) -> Iterable [Tuple [Label , Series ]]:
1003
+ def iteritems (self ) -> Iterable [Tuple [Hashable , Series ]]:
1005
1004
yield from self .items ()
1006
1005
1007
- def iterrows (self ) -> Iterable [Tuple [Label , Series ]]:
1006
+ def iterrows (self ) -> Iterable [Tuple [Hashable , Series ]]:
1008
1007
"""
1009
1008
Iterate over DataFrame rows as (index, Series) pairs.
1010
1009
@@ -2121,14 +2120,14 @@ def _from_arrays(
2121
2120
def to_stata (
2122
2121
self ,
2123
2122
path : FilePathOrBuffer ,
2124
- convert_dates : Optional [Dict [Label , str ]] = None ,
2123
+ convert_dates : Optional [Dict [Hashable , str ]] = None ,
2125
2124
write_index : bool = True ,
2126
2125
byteorder : Optional [str ] = None ,
2127
2126
time_stamp : Optional [datetime .datetime ] = None ,
2128
2127
data_label : Optional [str ] = None ,
2129
- variable_labels : Optional [Dict [Label , str ]] = None ,
2128
+ variable_labels : Optional [Dict [Hashable , str ]] = None ,
2130
2129
version : Optional [int ] = 114 ,
2131
- convert_strl : Optional [Sequence [Label ]] = None ,
2130
+ convert_strl : Optional [Sequence [Hashable ]] = None ,
2132
2131
compression : CompressionOptions = "infer" ,
2133
2132
storage_options : StorageOptions = None ,
2134
2133
) -> None :
@@ -4483,7 +4482,7 @@ def fillna(
4483
4482
downcast = downcast ,
4484
4483
)
4485
4484
4486
- def pop (self , item : Label ) -> Series :
4485
+ def pop (self , item : Hashable ) -> Series :
4487
4486
"""
4488
4487
Return item and drop from frame. Raise KeyError if not found.
4489
4488
@@ -4546,7 +4545,7 @@ def replace(
4546
4545
)
4547
4546
4548
4547
def _replace_columnwise (
4549
- self , mapping : Dict [Label , Tuple [Any , Any ]], inplace : bool , regex
4548
+ self , mapping : Dict [Hashable , Tuple [Any , Any ]], inplace : bool , regex
4550
4549
):
4551
4550
"""
4552
4551
Dispatch to Series.replace column-wise.
@@ -4724,7 +4723,7 @@ def set_index(
4724
4723
"one-dimensional arrays."
4725
4724
)
4726
4725
4727
- missing : List [Label ] = []
4726
+ missing : List [Hashable ] = []
4728
4727
for col in keys :
4729
4728
if isinstance (col , (Index , Series , np .ndarray , list , abc .Iterator )):
4730
4729
# arrays are fine as long as they are one-dimensional
@@ -4752,7 +4751,7 @@ def set_index(
4752
4751
frame = self .copy ()
4753
4752
4754
4753
arrays = []
4755
- names : List [Label ] = []
4754
+ names : List [Hashable ] = []
4756
4755
if append :
4757
4756
names = list (self .index .names )
4758
4757
if isinstance (self .index , MultiIndex ):
@@ -4761,7 +4760,7 @@ def set_index(
4761
4760
else :
4762
4761
arrays .append (self .index )
4763
4762
4764
- to_remove : List [Label ] = []
4763
+ to_remove : List [Hashable ] = []
4765
4764
for col in keys :
4766
4765
if isinstance (col , MultiIndex ):
4767
4766
for n in range (col .nlevels ):
@@ -4819,7 +4818,7 @@ def reset_index( # type: ignore[misc]
4819
4818
drop : bool = ...,
4820
4819
inplace : Literal [False ] = ...,
4821
4820
col_level : Hashable = ...,
4822
- col_fill : Label = ...,
4821
+ col_fill : Hashable = ...,
4823
4822
) -> DataFrame :
4824
4823
...
4825
4824
@@ -4830,7 +4829,7 @@ def reset_index(
4830
4829
drop : bool = ...,
4831
4830
inplace : Literal [True ] = ...,
4832
4831
col_level : Hashable = ...,
4833
- col_fill : Label = ...,
4832
+ col_fill : Hashable = ...,
4834
4833
) -> None :
4835
4834
...
4836
4835
@@ -4840,7 +4839,7 @@ def reset_index(
4840
4839
drop : bool = False ,
4841
4840
inplace : bool = False ,
4842
4841
col_level : Hashable = 0 ,
4843
- col_fill : Label = "" ,
4842
+ col_fill : Hashable = "" ,
4844
4843
) -> Optional [DataFrame ]:
4845
4844
"""
4846
4845
Reset the index, or a level of it.
@@ -5630,7 +5629,7 @@ def sort_index(
5630
5629
5631
5630
def value_counts (
5632
5631
self ,
5633
- subset : Optional [Sequence [Label ]] = None ,
5632
+ subset : Optional [Sequence [Hashable ]] = None ,
5634
5633
normalize : bool = False ,
5635
5634
sort : bool = True ,
5636
5635
ascending : bool = False ,
@@ -7511,7 +7510,7 @@ def diff(self, periods: int = 1, axis: Axis = 0) -> DataFrame:
7511
7510
7512
7511
def _gotitem (
7513
7512
self ,
7514
- key : Union [ Label , List [ Label ]] ,
7513
+ key : IndexLabel ,
7515
7514
ndim : int ,
7516
7515
subset : Optional [FrameOrSeriesUnion ] = None ,
7517
7516
) -> FrameOrSeriesUnion :
0 commit comments