@@ -70,10 +70,7 @@ from pandas.core.generic import NDFrame
7070from pandas .core .groupby .generic import SeriesGroupBy
7171from pandas .core .groupby .groupby import BaseGroupBy
7272from pandas .core .indexers import BaseIndexer
73- from pandas .core .indexes .accessors import (
74- PeriodProperties ,
75- _dtDescriptor ,
76- )
73+ from pandas .core .indexes .accessors import _dtDescriptor
7774from pandas .core .indexes .category import CategoricalIndex
7875from pandas .core .indexes .datetimes import DatetimeIndex
7976from pandas .core .indexes .interval import IntervalIndex
@@ -363,7 +360,7 @@ class Series(IndexOpsMixin[S1], NDFrame):
363360 dtype : PeriodDtype = ...,
364361 name : Hashable = ...,
365362 copy : bool = ...,
366- ) -> PeriodSeries : ...
363+ ) -> Series [ Period ] : ...
367364 @overload
368365 def __new__ (
369366 cls ,
@@ -851,6 +848,8 @@ class Series(IndexOpsMixin[S1], NDFrame):
851848 @overload
852849 def diff (self : Series [Timedelta ], periods : int = ...) -> Series [Timedelta ]: ... # type: ignore[overload-overlap]
853850 @overload
851+ def diff (self : Series [Period ], periods : int = ...) -> OffsetSeries : ... # type: ignore[overload-overlap]
852+ @overload
854853 def diff (self , periods : int = ...) -> Series [float ]: ...
855854 def autocorr (self , lag : int = 1 ) -> float : ...
856855 @overload
@@ -1234,8 +1233,7 @@ class Series(IndexOpsMixin[S1], NDFrame):
12341233 Series [_str ],
12351234 Series ,
12361235 ]: ...
1237- @property
1238- def dt (self ) -> _dtDescriptor [S1 ]: ...
1236+ dt = _dtDescriptor ()
12391237 @property
12401238 def plot (self ) -> PlotAccessor : ...
12411239 sparse = ...
@@ -1695,7 +1693,7 @@ class Series(IndexOpsMixin[S1], NDFrame):
16951693 ),
16961694 ) -> Series [Timedelta ]: ...
16971695 @overload
1698- def __add__ (self : Series [Timedelta ], other : Period ) -> PeriodSeries : ...
1696+ def __add__ (self : Series [Timedelta ], other : Period ) -> Series [ Period ] : ...
16991697 @overload
17001698 def __add__ (self : Series [bool ], other : bool | Sequence [bool ]) -> Series [bool ]: ...
17011699 @overload
@@ -1822,7 +1820,7 @@ class Series(IndexOpsMixin[S1], NDFrame):
18221820 level : Level | None = None ,
18231821 fill_value : float | None = None ,
18241822 axis : int = 0 ,
1825- ) -> PeriodSeries : ...
1823+ ) -> Series [ Period ] : ...
18261824 @overload
18271825 def add (
18281826 self : Series [bool ],
@@ -1957,7 +1955,7 @@ class Series(IndexOpsMixin[S1], NDFrame):
19571955 ),
19581956 ) -> Series [Timedelta ]: ...
19591957 @overload
1960- def __radd__ (self : Series [Timedelta ], other : Period ) -> PeriodSeries : ...
1958+ def __radd__ (self : Series [Timedelta ], other : Period ) -> Series [ Period ] : ...
19611959 @overload
19621960 def __radd__ (self : Series [bool ], other : bool | Sequence [bool ]) -> Series [bool ]: ...
19631961 @overload
@@ -2084,7 +2082,7 @@ class Series(IndexOpsMixin[S1], NDFrame):
20842082 level : Level | None = None ,
20852083 fill_value : float | None = None ,
20862084 axis : int = 0 ,
2087- ) -> PeriodSeries : ...
2085+ ) -> Series [ Period ] : ...
20882086 @overload
20892087 def radd (
20902088 self : Series [bool ],
@@ -3201,6 +3199,10 @@ class Series(IndexOpsMixin[S1], NDFrame):
32013199 ),
32023200 ) -> Series [Timedelta ]: ...
32033201 @overload
3202+ def __sub__ (
3203+ self : Series [Period ], other : Series [Period ] | Period
3204+ ) -> Series [BaseOffset ]: ...
3205+ @overload
32043206 def sub (
32053207 self : Series [Never ],
32063208 other : complex | NumListLike | Index [T_COMPLEX ] | Series [T_COMPLEX ],
@@ -3372,6 +3374,14 @@ class Series(IndexOpsMixin[S1], NDFrame):
33723374 axis : int = 0 ,
33733375 ) -> Series [Timedelta ]: ...
33743376 @overload
3377+ def sub (
3378+ self : Series [Period ],
3379+ other : Period | Sequence [Period ] | PeriodIndex | Series [Period ],
3380+ level : Level | None = None ,
3381+ fill_value : float | None = None ,
3382+ axis : int = 0 ,
3383+ ) -> Series [BaseOffset ]: ...
3384+ @overload
33753385 def __rsub__ (
33763386 self : Series [Never ],
33773387 other : (
@@ -3502,6 +3512,10 @@ class Series(IndexOpsMixin[S1], NDFrame):
35023512 ),
35033513 ) -> Series [Timedelta ]: ...
35043514 @overload
3515+ def __rsub__ (
3516+ self : Series [Period ], other : Series [Period ] | Period
3517+ ) -> Series [BaseOffset ]: ...
3518+ @overload
35053519 def rsub (
35063520 self : Series [Never ],
35073521 other : (
@@ -3682,6 +3696,14 @@ class Series(IndexOpsMixin[S1], NDFrame):
36823696 axis : int = 0 ,
36833697 ) -> Series [Timedelta ]: ...
36843698 @overload
3699+ def rsub (
3700+ self : Series [Period ],
3701+ other : Period | Sequence [Period ] | PeriodIndex | Series [Period ],
3702+ level : Level | None = None ,
3703+ fill_value : float | None = None ,
3704+ axis : int = 0 ,
3705+ ) -> Series [BaseOffset ]: ...
3706+ @overload
36853707 def __truediv__ ( # type: ignore[overload-overlap]
36863708 self : Series [Never ], other : complex | NumListLike | Index | Series
36873709 ) -> Series : ...
@@ -4623,6 +4645,22 @@ class Series(IndexOpsMixin[S1], NDFrame):
46234645 ** kwargs ,
46244646 ) -> np_1darray [GenericT ]: ...
46254647 @overload
4648+ def to_numpy (
4649+ self : Series [Period ],
4650+ dtype : None = None ,
4651+ copy : bool = False ,
4652+ na_value : Scalar = ...,
4653+ ** kwargs ,
4654+ ) -> np_1darray [np .object_ ]: ...
4655+ @overload
4656+ def to_numpy (
4657+ self : Series [Period ],
4658+ dtype : type [np .int64 ],
4659+ copy : bool = False ,
4660+ na_value : Scalar = ...,
4661+ ** kwargs ,
4662+ ) -> np_1darray [np .int64 ]: ...
4663+ @overload
46264664 def to_numpy ( # pyright: ignore[reportIncompatibleMethodOverride]
46274665 self ,
46284666 dtype : DTypeLike | None = None ,
@@ -4716,15 +4754,9 @@ class _SeriesSubclassBase(Series[S1], Generic[S1, GenericT_co]):
47164754 ** kwargs ,
47174755 ) -> np_1darray : ...
47184756
4719- class PeriodSeries (_SeriesSubclassBase [Period , np .object_ ]):
4720- @property
4721- def dt (self ) -> PeriodProperties : ... # type: ignore[override] # pyright: ignore[reportIncompatibleMethodOverride]
4722- def __sub__ (self , other : PeriodSeries ) -> OffsetSeries : ... # type: ignore[override] # pyright: ignore[reportIncompatibleMethodOverride]
4723- def diff (self , periods : int = ...) -> OffsetSeries : ... # type: ignore[override] # pyright: ignore[reportIncompatibleMethodOverride]
4724-
47254757class OffsetSeries (_SeriesSubclassBase [BaseOffset , np .object_ ]):
47264758 @overload # type: ignore[override]
4727- def __radd__ (self , other : Period ) -> PeriodSeries : ...
4759+ def __radd__ (self , other : Period ) -> Series [ Period ] : ...
47284760 @overload
47294761 def __radd__ ( # pyright: ignore[reportIncompatibleMethodOverride]
47304762 self , other : BaseOffset
0 commit comments