File tree Expand file tree Collapse file tree 2 files changed +32
-1
lines changed Expand file tree Collapse file tree 2 files changed +32
-1
lines changed Original file line number Diff line number Diff line change @@ -549,6 +549,25 @@ S1 = TypeVar(
549549 | BaseOffset ,
550550)
551551
552+ S2 = TypeVar (
553+ "S2" ,
554+ bound = str
555+ | bytes
556+ | datetime .date
557+ | datetime .time
558+ | bool
559+ | int
560+ | float
561+ | complex
562+ | Dtype
563+ | datetime .datetime # includes pd.Timestamp
564+ | datetime .timedelta # includes pd.Timedelta
565+ | Period
566+ | Interval
567+ | CategoricalDtype
568+ | BaseOffset ,
569+ )
570+
552571IndexingInt : TypeAlias = (
553572 int | np .int_ | np .integer | np .unsignedinteger | np .signedinteger | np .int8
554573)
Original file line number Diff line number Diff line change @@ -93,6 +93,7 @@ from pandas._libs.tslibs import BaseOffset
9393from pandas ._libs .tslibs .nattype import NaTType
9494from pandas ._typing import (
9595 S1 ,
96+ S2 ,
9697 AggFuncTypeBase ,
9798 AggFuncTypeDictFrame ,
9899 AggFuncTypeSeriesToFrame ,
@@ -913,7 +914,18 @@ class Series(IndexOpsMixin[S1], NDFrame):
913914 level : Level = ...,
914915 fill_value : int | _str | dict | None = ...,
915916 ) -> DataFrame : ...
916- def map (self , arg , na_action : Literal ["ignore" ] | None = ...) -> Series [S1 ]: ...
917+ @overload
918+ def map (
919+ self ,
920+ arg : Callable [[S1 ], S2 | NAType ] | Mapping [S1 , S2 ] | Series [S2 ],
921+ na_action : Literal ["ignore" ] = ...,
922+ ) -> Series [S2 ]: ...
923+ @overload
924+ def map (
925+ self ,
926+ arg : Callable [[S1 | NAType ], S2 | NAType ] | Mapping [S1 , S2 ] | Series [S2 ],
927+ na_action : None = ...,
928+ ) -> Series [S2 ]: ...
917929 @overload
918930 def aggregate ( # type: ignore[overload-overlap]
919931 self : Series [int ],
You can’t perform that action at this time.
0 commit comments