@@ -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
@@ -438,6 +437,24 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
438
437
_str | npt .DTypeLike | Mapping [HashableT2 , npt .DTypeLike ] | None
439
438
) = ...,
440
439
) -> np .recarray : ...
440
+ @overload
441
+ def to_stata (
442
+ self ,
443
+ path : FilePath | WriteBuffer [bytes ],
444
+ * ,
445
+ convert_dates : dict [HashableT1 , StataDateFormat ] | None = ...,
446
+ write_index : _bool = ...,
447
+ byteorder : Literal ["<" , ">" , "little" , "big" ] | None = ...,
448
+ time_stamp : dt .datetime | None = ...,
449
+ data_label : _str | None = ...,
450
+ variable_labels : dict [HashableT2 , str ] | None = ...,
451
+ version : Literal [117 , 118 , 119 ],
452
+ convert_strl : SequenceNotStr [Hashable ] | None = ...,
453
+ compression : CompressionOptions = ...,
454
+ storage_options : StorageOptions = ...,
455
+ value_labels : dict [Hashable , dict [float , str ]] | None = ...,
456
+ ) -> None : ...
457
+ @overload
441
458
def to_stata (
442
459
self ,
443
460
path : FilePath | WriteBuffer [bytes ],
@@ -449,7 +466,7 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
449
466
data_label : _str | None = ...,
450
467
variable_labels : dict [HashableT2 , str ] | None = ...,
451
468
version : Literal [114 , 117 , 118 , 119 ] | None = ...,
452
- convert_strl : list [ HashableT3 ] | None = ...,
469
+ convert_strl : None = ...,
453
470
compression : CompressionOptions = ...,
454
471
storage_options : StorageOptions = ...,
455
472
value_labels : dict [Hashable , dict [float , str ]] | None = ...,
@@ -462,7 +479,7 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
462
479
engine : ParquetEngine = ...,
463
480
compression : Literal ["snappy" , "gzip" , "brotli" , "lz4" , "zstd" ] | None = ...,
464
481
index : bool | None = ...,
465
- partition_cols : list [ HashableT ] | None = ...,
482
+ partition_cols : Sequence [ Hashable ] | None = ...,
466
483
storage_options : StorageOptions = ...,
467
484
** kwargs : Any ,
468
485
) -> None : ...
@@ -473,7 +490,7 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
473
490
engine : ParquetEngine = ...,
474
491
compression : Literal ["snappy" , "gzip" , "brotli" , "lz4" , "zstd" ] | None = ...,
475
492
index : bool | None = ...,
476
- partition_cols : list [ HashableT ] | None = ...,
493
+ partition_cols : Sequence [ Hashable ] | None = ...,
477
494
storage_options : StorageOptions = ...,
478
495
** kwargs : Any ,
479
496
) -> bytes : ...
@@ -499,7 +516,7 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
499
516
def to_html (
500
517
self ,
501
518
buf : FilePath | WriteBuffer [str ],
502
- columns : list [ HashableT ] | Index | Series | None = ...,
519
+ columns : SequenceNotStr [ Hashable ] | Index | Series | None = ...,
503
520
col_space : ColspaceArgType | None = ...,
504
521
header : _bool = ...,
505
522
index : _bool = ...,
@@ -546,7 +563,7 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
546
563
def to_html (
547
564
self ,
548
565
buf : None = ...,
549
- columns : Sequence [HashableT ] | None = ...,
566
+ columns : Sequence [Hashable ] | None = ...,
550
567
col_space : ColspaceArgType | None = ...,
551
568
header : _bool = ...,
552
569
index : _bool = ...,
@@ -597,8 +614,8 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
597
614
root_name : str = ...,
598
615
row_name : str = ...,
599
616
na_rep : str | None = ...,
600
- attr_cols : list [ HashableT1 ] | None = ...,
601
- elem_cols : list [ HashableT2 ] | None = ...,
617
+ attr_cols : SequenceNotStr [ Hashable ] | None = ...,
618
+ elem_cols : SequenceNotStr [ Hashable ] | None = ...,
602
619
namespaces : dict [str | None , str ] | None = ...,
603
620
prefix : str | None = ...,
604
621
encoding : str = ...,
@@ -617,8 +634,8 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
617
634
root_name : str | None = ...,
618
635
row_name : str | None = ...,
619
636
na_rep : str | None = ...,
620
- attr_cols : list [HashableT1 ] | None = ...,
621
- elem_cols : list [HashableT2 ] | None = ...,
637
+ attr_cols : list [Hashable ] | None = ...,
638
+ elem_cols : list [Hashable ] | None = ...,
622
639
namespaces : dict [str | None , str ] | None = ...,
623
640
prefix : str | None = ...,
624
641
encoding : str = ...,
@@ -846,7 +863,12 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
846
863
def set_index (
847
864
self ,
848
865
keys : (
849
- Label | Series | Index | np .ndarray | Iterator [HashableT ] | list [HashableT ]
866
+ Label
867
+ | Series
868
+ | Index
869
+ | np .ndarray
870
+ | Iterator [Hashable ]
871
+ | Sequence [Hashable ]
850
872
),
851
873
* ,
852
874
drop : _bool = ...,
@@ -858,7 +880,12 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
858
880
def set_index (
859
881
self ,
860
882
keys : (
861
- Label | Series | Index | np .ndarray | Iterator [HashableT ] | list [HashableT ]
883
+ Label
884
+ | Series
885
+ | Index
886
+ | np .ndarray
887
+ | Iterator [Hashable ]
888
+ | Sequence [Hashable ]
862
889
),
863
890
* ,
864
891
drop : _bool = ...,
@@ -876,7 +903,7 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
876
903
col_fill : Hashable = ...,
877
904
inplace : Literal [True ],
878
905
allow_duplicates : _bool = ...,
879
- names : Hashable | list [ HashableT ] = ...,
906
+ names : Hashable | Sequence [ Hashable ] = ...,
880
907
) -> None : ...
881
908
@overload
882
909
def reset_index (
@@ -888,7 +915,7 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
888
915
drop : _bool = ...,
889
916
inplace : Literal [False ] = ...,
890
917
allow_duplicates : _bool = ...,
891
- names : Hashable | list [ HashableT ] = ...,
918
+ names : Hashable | Sequence [ Hashable ] = ...,
892
919
) -> Self : ...
893
920
@overload
894
921
def reset_index (
@@ -900,7 +927,7 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
900
927
col_level : int | _str = ...,
901
928
col_fill : Hashable = ...,
902
929
allow_duplicates : _bool = ...,
903
- names : Hashable | list [ HashableT ] = ...,
930
+ names : Hashable | Sequence [ Hashable ] = ...,
904
931
) -> Self | None : ...
905
932
def isna (self ) -> Self : ...
906
933
def isnull (self ) -> Self : ...
@@ -1681,7 +1708,7 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
1681
1708
def columns (self ) -> Index [str ]: ...
1682
1709
@columns .setter # setter needs to be right next to getter; otherwise mypy complains
1683
1710
def columns (
1684
- self , cols : AnyArrayLike | list [ HashableT ] | tuple [HashableT , ...]
1711
+ self , cols : AnyArrayLike | SequenceNotStr [ Hashable ] | tuple [Hashable , ...]
1685
1712
) -> None : ...
1686
1713
@property
1687
1714
def dtypes (self ) -> Series : ...
@@ -2359,8 +2386,8 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
2359
2386
def to_string (
2360
2387
self ,
2361
2388
buf : FilePath | WriteBuffer [str ],
2362
- columns : list [ HashableT1 ] | Index | Series | None = ...,
2363
- col_space : int | list [int ] | dict [HashableT2 , int ] | None = ...,
2389
+ columns : SequenceNotStr [ Hashable ] | Index | Series | None = ...,
2390
+ col_space : int | list [int ] | dict [HashableT , int ] | None = ...,
2364
2391
header : _bool | list [_str ] | tuple [str , ...] = ...,
2365
2392
index : _bool = ...,
2366
2393
na_rep : _str = ...,
@@ -2382,7 +2409,7 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
2382
2409
def to_string (
2383
2410
self ,
2384
2411
buf : None = ...,
2385
- columns : list [ HashableT ] | Index | Series | None = ...,
2412
+ columns : Sequence [ Hashable ] | Index | Series | None = ...,
2386
2413
col_space : int | list [int ] | dict [Hashable , int ] | None = ...,
2387
2414
header : _bool | Sequence [_str ] = ...,
2388
2415
index : _bool = ...,
0 commit comments