@@ -58,7 +58,7 @@ from pandas.core.indexing import (
5858 _LocIndexer ,
5959)
6060from pandas .core .reshape .pivot import (
61- _PivotAggFunc ,
61+ _PivotAggFuncTypes ,
6262 _PivotTableColumnsTypes ,
6363 _PivotTableIndexTypes ,
6464 _PivotTableValuesTypes ,
@@ -178,7 +178,7 @@ from pandas.plotting import PlotAccessor
178178from pandas .plotting ._core import _BoxPlotT
179179
180180_T_MUTABLE_MAPPING_co = TypeVar (
181- "_T_MUTABLE_MAPPING_co" , bound = MutableMapping , covariant = True
181+ "_T_MUTABLE_MAPPING_co" , bound = MutableMapping [ Any , Any ] , covariant = True
182182)
183183
184184class _iLocIndexerFrame (_iLocIndexer , Generic [_T ]):
@@ -361,28 +361,23 @@ class _AtIndexerFrame(_AtIndexer):
361361 ),
362362 ) -> None : ...
363363
364- # With mypy 1.14.1 and python 3.12, the second overload needs a type-ignore statement
365- if sys . version_info >= ( 3 , 12 ):
366- class _GetItemHack :
367- @ overload
368- def __getitem__ ( self , key : Scalar | tuple [ Hashable , ...]) -> Series : ... # type: ignore[overload-overlap] # pyright: ignore[reportOverlappingOverload]
364+ class _GetItemHack :
365+ @ overload
366+ def __getitem__ ( self , key : Scalar | tuple [ Hashable , ...]) -> Series : ... # type: ignore[overload-overlap] # pyright: ignore[reportOverlappingOverload]
367+ # With mypy 1.14.1 and python 3.12, the second overload needs a type-ignore statement
368+ if sys . version_info >= ( 3 , 12 ):
369369 @overload
370370 def __getitem__ ( # type: ignore[overload-overlap] # pyright: ignore[reportOverlappingOverload]
371371 self , key : Iterable [Hashable ] | slice
372372 ) -> Self : ...
373- @overload
374- def __getitem__ (self , key : Hashable ) -> Series : ...
375-
376- else :
377- class _GetItemHack :
378- @overload
379- def __getitem__ (self , key : Scalar | tuple [Hashable , ...]) -> Series : ... # type: ignore[overload-overlap] # pyright: ignore[reportOverlappingOverload]
373+ else :
380374 @overload
381375 def __getitem__ ( # pyright: ignore[reportOverlappingOverload]
382376 self , key : Iterable [Hashable ] | slice
383377 ) -> Self : ...
384- @overload
385- def __getitem__ (self , key : Hashable ) -> Series : ...
378+
379+ @overload
380+ def __getitem__ (self , key : Hashable ) -> Series : ...
386381
387382_AstypeArgExt : TypeAlias = (
388383 AstypeArg
@@ -484,7 +479,7 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
484479 self ,
485480 orient : str = ...,
486481 * ,
487- into : type [defaultdict ],
482+ into : type [defaultdict [ Any , Any ] ],
488483 index : Literal [True ] = True ,
489484 ) -> Never : ...
490485 @overload
@@ -500,7 +495,7 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
500495 self ,
501496 orient : Literal ["records" ],
502497 * ,
503- into : type [dict ] = ...,
498+ into : type [dict [ Any , Any ] ] = ...,
504499 index : Literal [True ] = True ,
505500 ) -> list [dict [Hashable , Any ]]: ...
506501 @overload
@@ -516,23 +511,23 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
516511 self ,
517512 orient : Literal ["index" ],
518513 * ,
519- into : OrderedDict | type [OrderedDict ],
514+ into : OrderedDict [ Any , Any ] | type [OrderedDict [ Any , Any ] ],
520515 index : Literal [True ] = True ,
521516 ) -> OrderedDict [Hashable , dict [Hashable , Any ]]: ...
522517 @overload
523518 def to_dict (
524519 self ,
525520 orient : Literal ["index" ],
526521 * ,
527- into : type [MutableMapping ],
522+ into : type [MutableMapping [ Any , Any ] ],
528523 index : Literal [True ] = True ,
529524 ) -> MutableMapping [Hashable , dict [Hashable , Any ]]: ...
530525 @overload
531526 def to_dict (
532527 self ,
533528 orient : Literal ["index" ],
534529 * ,
535- into : type [dict ] = ...,
530+ into : type [dict [ Any , Any ] ] = ...,
536531 index : Literal [True ] = True ,
537532 ) -> dict [Hashable , dict [Hashable , Any ]]: ...
538533 @overload
@@ -548,23 +543,23 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
548543 self ,
549544 orient : Literal ["dict" , "list" , "series" ] = ...,
550545 * ,
551- into : type [dict ] = ...,
546+ into : type [dict [ Any , Any ] ] = ...,
552547 index : Literal [True ] = True ,
553548 ) -> dict [Hashable , Any ]: ...
554549 @overload
555550 def to_dict (
556551 self ,
557552 orient : Literal ["split" , "tight" ],
558553 * ,
559- into : MutableMapping [Any , Any ] | type [MutableMapping ],
554+ into : MutableMapping [Any , Any ] | type [MutableMapping [ Any , Any ] ],
560555 index : bool = ...,
561556 ) -> MutableMapping [str , list [Any ]]: ...
562557 @overload
563558 def to_dict (
564559 self ,
565560 orient : Literal ["split" , "tight" ],
566561 * ,
567- into : type [dict ] = ...,
562+ into : type [dict [ Any , Any ] ] = ...,
568563 index : bool = ...,
569564 ) -> dict [str , list [Any ]]: ...
570565 @classmethod
@@ -583,16 +578,29 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
583578 coerce_float : bool = False ,
584579 nrows : int | None = None ,
585580 ) -> Self : ...
586- def to_records (
587- self ,
588- index : _bool = True ,
589- column_dtypes : (
590- _str | npt .DTypeLike | Mapping [HashableT1 , npt .DTypeLike ] | None
591- ) = None ,
592- index_dtypes : (
593- _str | npt .DTypeLike | Mapping [HashableT2 , npt .DTypeLike ] | None
594- ) = None ,
595- ) -> np .recarray : ...
581+ if sys .version_info >= (3 , 11 ):
582+ def to_records (
583+ self ,
584+ index : _bool = True ,
585+ column_dtypes : (
586+ _str | npt .DTypeLike | Mapping [HashableT1 , npt .DTypeLike ] | None
587+ ) = None ,
588+ index_dtypes : (
589+ _str | npt .DTypeLike | Mapping [HashableT2 , npt .DTypeLike ] | None
590+ ) = None ,
591+ ) -> np .recarray : ...
592+ else :
593+ def to_records (
594+ self ,
595+ index : _bool = True ,
596+ column_dtypes : (
597+ _str | npt .DTypeLike | Mapping [HashableT1 , npt .DTypeLike ] | None
598+ ) = None ,
599+ index_dtypes : (
600+ _str | npt .DTypeLike | Mapping [HashableT2 , npt .DTypeLike ] | None
601+ ) = None ,
602+ ) -> np .recarray [Any , Any ]: ...
603+
596604 @overload
597605 def to_stata (
598606 self ,
@@ -1381,7 +1389,7 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
13811389 dropna : _bool = ...,
13821390 ) -> DataFrameGroupBy [Period , Literal [False ]]: ...
13831391 @overload
1384- def groupby ( # pyright: ignore reportOverlappingOverload
1392+ def groupby (
13851393 self ,
13861394 by : IntervalIndex [IntervalT ],
13871395 level : IndexLabel | None = ...,
@@ -1394,7 +1402,7 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
13941402 @overload
13951403 def groupby (
13961404 self ,
1397- by : IntervalIndex [ IntervalT ] ,
1405+ by : IntervalIndex ,
13981406 level : IndexLabel | None = ...,
13991407 as_index : Literal [False ] = False ,
14001408 sort : _bool = ...,
@@ -1480,9 +1488,7 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
14801488 values : _PivotTableValuesTypes = None ,
14811489 index : _PivotTableIndexTypes = None ,
14821490 columns : _PivotTableColumnsTypes = None ,
1483- aggfunc : (
1484- _PivotAggFunc | Sequence [_PivotAggFunc ] | Mapping [Hashable , _PivotAggFunc ]
1485- ) = "mean" ,
1491+ aggfunc : _PivotAggFuncTypes [Scalar ] = "mean" ,
14861492 fill_value : Scalar | None = None ,
14871493 margins : _bool = False ,
14881494 dropna : _bool = True ,
@@ -2863,8 +2869,12 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
28632869 def __rfloordiv__ (
28642870 self , other : float | DataFrame | Series [int ] | Series [float ] | Sequence [float ]
28652871 ) -> Self : ...
2866- def __truediv__ (self , other : float | DataFrame | Series | Sequence ) -> Self : ...
2867- def __rtruediv__ (self , other : float | DataFrame | Series | Sequence ) -> Self : ...
2872+ def __truediv__ (
2873+ self , other : float | DataFrame | Series | Sequence [Any ]
2874+ ) -> Self : ...
2875+ def __rtruediv__ (
2876+ self , other : float | DataFrame | Series | Sequence [Any ]
2877+ ) -> Self : ...
28682878 @final
28692879 def __bool__ (self ) -> NoReturn : ...
28702880
0 commit comments