@@ -117,6 +117,8 @@ from pandas._typing import (
117117 IndexingInt ,
118118 IndexKeyFunc ,
119119 IndexLabel ,
120+ IndexStrT0 ,
121+ IndexT0 ,
120122 IndexType ,
121123 InterpolateOptions ,
122124 IntervalClosedType ,
@@ -378,10 +380,19 @@ _AstypeArgExt: TypeAlias = (
378380)
379381_AstypeArgExtList : TypeAlias = _AstypeArgExt | list [_AstypeArgExt ]
380382
381- class DataFrame (NDFrame , OpsMixin , _GetItemHack ):
383+ class DataFrame (NDFrame , OpsMixin , _GetItemHack , Generic [ IndexT0 , IndexStrT0 ] ):
382384
383385 __hash__ : ClassVar [None ] # type: ignore[assignment] # pyright: ignore[reportIncompatibleMethodOverride]
384386
387+ @overload
388+ def __new__ (
389+ cls ,
390+ data : DataFrame [IndexT0 , IndexStrT0 ],
391+ index : None = None ,
392+ columns : None = None ,
393+ dtype : Dtype | None = None ,
394+ copy : _bool | None = None ,
395+ ) -> DataFrame [IndexT0 , IndexStrT0 ]: ...
385396 @overload
386397 def __new__ (
387398 cls ,
@@ -398,6 +409,15 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
398409 copy : _bool | None = None ,
399410 ) -> Self : ...
400411 @overload
412+ def __new__ (
413+ cls ,
414+ data : Scalar ,
415+ index : IndexT0 ,
416+ columns : IndexStrT0 ,
417+ dtype : Dtype | None = None ,
418+ copy : _bool | None = None ,
419+ ) -> DataFrame [IndexT0 , IndexStrT0 ]: ...
420+ @overload
401421 def __new__ (
402422 cls ,
403423 data : Scalar ,
@@ -1898,7 +1918,7 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
18981918 @property
18991919 def at (self ) -> _AtIndexerFrame : ...
19001920 @property
1901- def columns (self ) -> Index [ str ] : ...
1921+ def columns (self ) -> IndexStrT0 : ...
19021922 @columns .setter # setter needs to be right next to getter; otherwise mypy complains
19031923 def columns (
19041924 self , cols : AnyArrayLike | SequenceNotStr [Hashable ] | tuple [Hashable , ...]
@@ -1912,7 +1932,7 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
19121932 @property
19131933 def iloc (self ) -> _iLocIndexerFrame [Self ]: ...
19141934 @property
1915- def index (self ) -> Index : ...
1935+ def index (self ) -> IndexT0 : ...
19161936 @index .setter
19171937 def index (
19181938 self , idx : AnyArrayLike | SequenceNotStr [Hashable ] | tuple [Hashable , ...]
@@ -2289,7 +2309,7 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
22892309 inplace : Literal [False ] = False ,
22902310 ** kwargs : Any ,
22912311 ) -> Self : ...
2292- def keys (self ) -> Index : ...
2312+ def keys (self ) -> IndexStrT0 : ...
22932313 def kurt (
22942314 self ,
22952315 axis : Axis | None = ...,
0 commit comments