@@ -88,7 +88,6 @@ from pandas._typing import (
88
88
HashableT ,
89
89
HashableT1 ,
90
90
HashableT2 ,
91
- HashableT3 ,
92
91
IgnoreRaise ,
93
92
IndexingInt ,
94
93
IndexLabel ,
@@ -175,13 +174,13 @@ class _LocIndexerFrame(_LocIndexer, Generic[_T]):
175
174
@overload
176
175
def __getitem__ (self , idx : Scalar ) -> Series | _T : ...
177
176
@overload
178
- def __getitem__ (
177
+ def __getitem__ ( # type: ignore[overload-overlap]
179
178
self ,
180
179
idx : (
181
180
IndexType
182
181
| MaskType
183
- | Callable [[DataFrame ], IndexType | MaskType | list [ HashableT ]]
184
- | list [HashableT ]
182
+ | Callable [[DataFrame ], IndexType | MaskType | Sequence [ Hashable ]]
183
+ | list [Hashable ]
185
184
| tuple [
186
185
IndexType
187
186
| MaskType
@@ -236,7 +235,7 @@ class _LocIndexerFrame(_LocIndexer, Generic[_T]):
236
235
@overload
237
236
def __setitem__ (
238
237
self ,
239
- idx : tuple [_IndexSliceTuple , HashableT ],
238
+ idx : tuple [_IndexSliceTuple , Hashable ],
240
239
value : Scalar | NAType | NaTType | ArrayLike | Series | list | None ,
241
240
) -> None : ...
242
241
@@ -432,10 +431,10 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
432
431
self ,
433
432
index : _bool = ...,
434
433
column_dtypes : (
435
- _str | npt .DTypeLike | Mapping [HashableT1 , npt .DTypeLike ] | None
434
+ _str | npt .DTypeLike | Mapping [Hashable , npt .DTypeLike ] | None
436
435
) = ...,
437
436
index_dtypes : (
438
- _str | npt .DTypeLike | Mapping [HashableT2 , npt .DTypeLike ] | None
437
+ _str | npt .DTypeLike | Mapping [Hashable , npt .DTypeLike ] | None
439
438
) = ...,
440
439
) -> np .recarray : ...
441
440
def to_stata (
@@ -449,7 +448,7 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
449
448
data_label : _str | None = ...,
450
449
variable_labels : dict [HashableT2 , str ] | None = ...,
451
450
version : Literal [114 , 117 , 118 , 119 ] | None = ...,
452
- convert_strl : list [HashableT3 ] | None = ...,
451
+ convert_strl : list [Hashable ] | None = ...,
453
452
compression : CompressionOptions = ...,
454
453
storage_options : StorageOptions = ...,
455
454
value_labels : dict [Hashable , dict [float , str ]] | None = ...,
@@ -462,7 +461,7 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
462
461
engine : ParquetEngine = ...,
463
462
compression : Literal ["snappy" , "gzip" , "brotli" , "lz4" , "zstd" ] | None = ...,
464
463
index : bool | None = ...,
465
- partition_cols : list [ HashableT ] | None = ...,
464
+ partition_cols : Sequence [ Hashable ] | None = ...,
466
465
storage_options : StorageOptions = ...,
467
466
** kwargs : Any ,
468
467
) -> None : ...
@@ -473,7 +472,7 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
473
472
engine : ParquetEngine = ...,
474
473
compression : Literal ["snappy" , "gzip" , "brotli" , "lz4" , "zstd" ] | None = ...,
475
474
index : bool | None = ...,
476
- partition_cols : list [ HashableT ] | None = ...,
475
+ partition_cols : Sequence [ Hashable ] | None = ...,
477
476
storage_options : StorageOptions = ...,
478
477
** kwargs : Any ,
479
478
) -> bytes : ...
@@ -499,7 +498,7 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
499
498
def to_html (
500
499
self ,
501
500
buf : FilePath | WriteBuffer [str ],
502
- columns : list [HashableT ] | Index | Series | None = ...,
501
+ columns : list [Hashable ] | Index | Series | None = ...,
503
502
col_space : ColspaceArgType | None = ...,
504
503
header : _bool = ...,
505
504
index : _bool = ...,
@@ -546,7 +545,7 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
546
545
def to_html (
547
546
self ,
548
547
buf : None = ...,
549
- columns : Sequence [HashableT ] | None = ...,
548
+ columns : Sequence [Hashable ] | None = ...,
550
549
col_space : ColspaceArgType | None = ...,
551
550
header : _bool = ...,
552
551
index : _bool = ...,
@@ -597,8 +596,8 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
597
596
root_name : str = ...,
598
597
row_name : str = ...,
599
598
na_rep : str | None = ...,
600
- attr_cols : list [HashableT1 ] | None = ...,
601
- elem_cols : list [HashableT2 ] | None = ...,
599
+ attr_cols : list [Hashable ] | None = ...,
600
+ elem_cols : list [Hashable ] | None = ...,
602
601
namespaces : dict [str | None , str ] | None = ...,
603
602
prefix : str | None = ...,
604
603
encoding : str = ...,
@@ -617,8 +616,8 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
617
616
root_name : str | None = ...,
618
617
row_name : str | None = ...,
619
618
na_rep : str | None = ...,
620
- attr_cols : list [HashableT1 ] | None = ...,
621
- elem_cols : list [HashableT2 ] | None = ...,
619
+ attr_cols : list [Hashable ] | None = ...,
620
+ elem_cols : list [Hashable ] | None = ...,
622
621
namespaces : dict [str | None , str ] | None = ...,
623
622
prefix : str | None = ...,
624
623
encoding : str = ...,
@@ -846,7 +845,12 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
846
845
def set_index (
847
846
self ,
848
847
keys : (
849
- Label | Series | Index | np .ndarray | Iterator [HashableT ] | list [HashableT ]
848
+ Label
849
+ | Series
850
+ | Index
851
+ | np .ndarray
852
+ | Iterator [Hashable ]
853
+ | Sequence [Hashable ]
850
854
),
851
855
* ,
852
856
drop : _bool = ...,
@@ -858,7 +862,12 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
858
862
def set_index (
859
863
self ,
860
864
keys : (
861
- Label | Series | Index | np .ndarray | Iterator [HashableT ] | list [HashableT ]
865
+ Label
866
+ | Series
867
+ | Index
868
+ | np .ndarray
869
+ | Iterator [Hashable ]
870
+ | Sequence [Hashable ]
862
871
),
863
872
* ,
864
873
drop : _bool = ...,
@@ -876,7 +885,7 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
876
885
col_fill : Hashable = ...,
877
886
inplace : Literal [True ],
878
887
allow_duplicates : _bool = ...,
879
- names : Hashable | list [ HashableT ] = ...,
888
+ names : Hashable | Sequence [ Hashable ] = ...,
880
889
) -> None : ...
881
890
@overload
882
891
def reset_index (
@@ -888,7 +897,7 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
888
897
drop : _bool = ...,
889
898
inplace : Literal [False ] = ...,
890
899
allow_duplicates : _bool = ...,
891
- names : Hashable | list [ HashableT ] = ...,
900
+ names : Hashable | Sequence [ Hashable ] = ...,
892
901
) -> Self : ...
893
902
@overload
894
903
def reset_index (
@@ -900,7 +909,7 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
900
909
col_level : int | _str = ...,
901
910
col_fill : Hashable = ...,
902
911
allow_duplicates : _bool = ...,
903
- names : Hashable | list [ HashableT ] = ...,
912
+ names : Hashable | Sequence [ Hashable ] = ...,
904
913
) -> Self | None : ...
905
914
def isna (self ) -> Self : ...
906
915
def isnull (self ) -> Self : ...
@@ -1681,7 +1690,7 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
1681
1690
def columns (self ) -> Index [str ]: ...
1682
1691
@columns .setter # setter needs to be right next to getter; otherwise mypy complains
1683
1692
def columns (
1684
- self , cols : AnyArrayLike | list [HashableT ] | tuple [HashableT , ...]
1693
+ self , cols : AnyArrayLike | list [Hashable ] | tuple [Hashable , ...]
1685
1694
) -> None : ...
1686
1695
@property
1687
1696
def dtypes (self ) -> Series : ...
@@ -2359,8 +2368,8 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
2359
2368
def to_string (
2360
2369
self ,
2361
2370
buf : FilePath | WriteBuffer [str ],
2362
- columns : list [ HashableT1 ] | Index | Series | None = ...,
2363
- col_space : int | list [int ] | dict [HashableT2 , int ] | None = ...,
2371
+ columns : Sequence [ Hashable ] | Index | Series | None = ...,
2372
+ col_space : int | list [int ] | dict [Hashable , int ] | None = ...,
2364
2373
header : _bool | list [_str ] | tuple [str , ...] = ...,
2365
2374
index : _bool = ...,
2366
2375
na_rep : _str = ...,
@@ -2382,7 +2391,7 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
2382
2391
def to_string (
2383
2392
self ,
2384
2393
buf : None = ...,
2385
- columns : list [ HashableT ] | Index | Series | None = ...,
2394
+ columns : Sequence [ Hashable ] | Index | Series | None = ...,
2386
2395
col_space : int | list [int ] | dict [Hashable , int ] | None = ...,
2387
2396
header : _bool | Sequence [_str ] = ...,
2388
2397
index : _bool = ...,
0 commit comments