@@ -70,10 +70,7 @@ from pandas.core.generic import NDFrame
70
70
from pandas .core .groupby .generic import SeriesGroupBy
71
71
from pandas .core .groupby .groupby import BaseGroupBy
72
72
from 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
77
74
from pandas .core .indexes .category import CategoricalIndex
78
75
from pandas .core .indexes .datetimes import DatetimeIndex
79
76
from pandas .core .indexes .interval import IntervalIndex
@@ -363,7 +360,7 @@ class Series(IndexOpsMixin[S1], NDFrame):
363
360
dtype : PeriodDtype = ...,
364
361
name : Hashable = ...,
365
362
copy : bool = ...,
366
- ) -> PeriodSeries : ...
363
+ ) -> Series [ Period ] : ...
367
364
@overload
368
365
def __new__ (
369
366
cls ,
@@ -851,6 +848,8 @@ class Series(IndexOpsMixin[S1], NDFrame):
851
848
@overload
852
849
def diff (self : Series [Timedelta ], periods : int = ...) -> Series [Timedelta ]: ... # type: ignore[overload-overlap]
853
850
@overload
851
+ def diff (self : Series [Period ], periods : int = ...) -> OffsetSeries : ... # type: ignore[overload-overlap]
852
+ @overload
854
853
def diff (self , periods : int = ...) -> Series [float ]: ...
855
854
def autocorr (self , lag : int = 1 ) -> float : ...
856
855
@overload
@@ -1234,8 +1233,7 @@ class Series(IndexOpsMixin[S1], NDFrame):
1234
1233
Series [_str ],
1235
1234
Series ,
1236
1235
]: ...
1237
- @property
1238
- def dt (self ) -> _dtDescriptor [S1 ]: ...
1236
+ dt = _dtDescriptor ()
1239
1237
@property
1240
1238
def plot (self ) -> PlotAccessor : ...
1241
1239
sparse = ...
@@ -1695,7 +1693,7 @@ class Series(IndexOpsMixin[S1], NDFrame):
1695
1693
),
1696
1694
) -> Series [Timedelta ]: ...
1697
1695
@overload
1698
- def __add__ (self : Series [Timedelta ], other : Period ) -> PeriodSeries : ...
1696
+ def __add__ (self : Series [Timedelta ], other : Period ) -> Series [ Period ] : ...
1699
1697
@overload
1700
1698
def __add__ (self : Series [bool ], other : bool | Sequence [bool ]) -> Series [bool ]: ...
1701
1699
@overload
@@ -1822,7 +1820,7 @@ class Series(IndexOpsMixin[S1], NDFrame):
1822
1820
level : Level | None = None ,
1823
1821
fill_value : float | None = None ,
1824
1822
axis : int = 0 ,
1825
- ) -> PeriodSeries : ...
1823
+ ) -> Series [ Period ] : ...
1826
1824
@overload
1827
1825
def add (
1828
1826
self : Series [bool ],
@@ -1957,7 +1955,7 @@ class Series(IndexOpsMixin[S1], NDFrame):
1957
1955
),
1958
1956
) -> Series [Timedelta ]: ...
1959
1957
@overload
1960
- def __radd__ (self : Series [Timedelta ], other : Period ) -> PeriodSeries : ...
1958
+ def __radd__ (self : Series [Timedelta ], other : Period ) -> Series [ Period ] : ...
1961
1959
@overload
1962
1960
def __radd__ (self : Series [bool ], other : bool | Sequence [bool ]) -> Series [bool ]: ...
1963
1961
@overload
@@ -2084,7 +2082,7 @@ class Series(IndexOpsMixin[S1], NDFrame):
2084
2082
level : Level | None = None ,
2085
2083
fill_value : float | None = None ,
2086
2084
axis : int = 0 ,
2087
- ) -> PeriodSeries : ...
2085
+ ) -> Series [ Period ] : ...
2088
2086
@overload
2089
2087
def radd (
2090
2088
self : Series [bool ],
@@ -3201,6 +3199,10 @@ class Series(IndexOpsMixin[S1], NDFrame):
3201
3199
),
3202
3200
) -> Series [Timedelta ]: ...
3203
3201
@overload
3202
+ def __sub__ (
3203
+ self : Series [Period ], other : Series [Period ] | Period
3204
+ ) -> Series [BaseOffset ]: ...
3205
+ @overload
3204
3206
def sub (
3205
3207
self : Series [Never ],
3206
3208
other : complex | NumListLike | Index [T_COMPLEX ] | Series [T_COMPLEX ],
@@ -3372,6 +3374,14 @@ class Series(IndexOpsMixin[S1], NDFrame):
3372
3374
axis : int = 0 ,
3373
3375
) -> Series [Timedelta ]: ...
3374
3376
@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
3375
3385
def __rsub__ (
3376
3386
self : Series [Never ],
3377
3387
other : (
@@ -3502,6 +3512,10 @@ class Series(IndexOpsMixin[S1], NDFrame):
3502
3512
),
3503
3513
) -> Series [Timedelta ]: ...
3504
3514
@overload
3515
+ def __rsub__ (
3516
+ self : Series [Period ], other : Series [Period ] | Period
3517
+ ) -> Series [BaseOffset ]: ...
3518
+ @overload
3505
3519
def rsub (
3506
3520
self : Series [Never ],
3507
3521
other : (
@@ -3682,6 +3696,14 @@ class Series(IndexOpsMixin[S1], NDFrame):
3682
3696
axis : int = 0 ,
3683
3697
) -> Series [Timedelta ]: ...
3684
3698
@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
3685
3707
def __truediv__ ( # type: ignore[overload-overlap]
3686
3708
self : Series [Never ], other : complex | NumListLike | Index | Series
3687
3709
) -> Series : ...
@@ -4623,6 +4645,22 @@ class Series(IndexOpsMixin[S1], NDFrame):
4623
4645
** kwargs ,
4624
4646
) -> np_1darray [GenericT ]: ...
4625
4647
@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
4626
4664
def to_numpy ( # pyright: ignore[reportIncompatibleMethodOverride]
4627
4665
self ,
4628
4666
dtype : DTypeLike | None = None ,
@@ -4716,15 +4754,9 @@ class _SeriesSubclassBase(Series[S1], Generic[S1, GenericT_co]):
4716
4754
** kwargs ,
4717
4755
) -> np_1darray : ...
4718
4756
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
-
4725
4757
class OffsetSeries (_SeriesSubclassBase [BaseOffset , np .object_ ]):
4726
4758
@overload # type: ignore[override]
4727
- def __radd__ (self , other : Period ) -> PeriodSeries : ...
4759
+ def __radd__ (self , other : Period ) -> Series [ Period ] : ...
4728
4760
@overload
4729
4761
def __radd__ ( # pyright: ignore[reportIncompatibleMethodOverride]
4730
4762
self , other : BaseOffset
0 commit comments