@@ -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
@@ -1695,7 +1694,7 @@ class Series(IndexOpsMixin[S1], NDFrame):
1695
1694
),
1696
1695
) -> Series [Timedelta ]: ...
1697
1696
@overload
1698
- def __add__ (self : Series [Timedelta ], other : Period ) -> PeriodSeries : ...
1697
+ def __add__ (self : Series [Timedelta ], other : Period ) -> Series [ Period ] : ...
1699
1698
@overload
1700
1699
def __add__ (self : Series [bool ], other : bool | Sequence [bool ]) -> Series [bool ]: ...
1701
1700
@overload
@@ -1822,7 +1821,7 @@ class Series(IndexOpsMixin[S1], NDFrame):
1822
1821
level : Level | None = None ,
1823
1822
fill_value : float | None = None ,
1824
1823
axis : int = 0 ,
1825
- ) -> PeriodSeries : ...
1824
+ ) -> Series [ Period ] : ...
1826
1825
@overload
1827
1826
def add (
1828
1827
self : Series [bool ],
@@ -1957,7 +1956,7 @@ class Series(IndexOpsMixin[S1], NDFrame):
1957
1956
),
1958
1957
) -> Series [Timedelta ]: ...
1959
1958
@overload
1960
- def __radd__ (self : Series [Timedelta ], other : Period ) -> PeriodSeries : ...
1959
+ def __radd__ (self : Series [Timedelta ], other : Period ) -> Series [ Period ] : ...
1961
1960
@overload
1962
1961
def __radd__ (self : Series [bool ], other : bool | Sequence [bool ]) -> Series [bool ]: ...
1963
1962
@overload
@@ -2084,7 +2083,7 @@ class Series(IndexOpsMixin[S1], NDFrame):
2084
2083
level : Level | None = None ,
2085
2084
fill_value : float | None = None ,
2086
2085
axis : int = 0 ,
2087
- ) -> PeriodSeries : ...
2086
+ ) -> Series [ Period ] : ...
2088
2087
@overload
2089
2088
def radd (
2090
2089
self : Series [bool ],
@@ -3079,7 +3078,7 @@ class Series(IndexOpsMixin[S1], NDFrame):
3079
3078
other : complex | NumListLike | Index [T_COMPLEX ] | Series [T_COMPLEX ],
3080
3079
) -> Series : ...
3081
3080
@overload
3082
- def __sub__ (self , other : Index [Never ] | Series [Never ]) -> Series : ...
3081
+ def __sub__ (self , other : Index [Never ] | Series [Never ]) -> Series : ... # type: ignore[overload-overlap]
3083
3082
@overload
3084
3083
def __sub__ (
3085
3084
self : Series [bool ],
@@ -3201,6 +3200,8 @@ class Series(IndexOpsMixin[S1], NDFrame):
3201
3200
),
3202
3201
) -> Series [Timedelta ]: ...
3203
3202
@overload
3203
+ def __sub__ (self : Series [Period ], other : Series [Period ]) -> OffsetSeries : ...
3204
+ @overload
3204
3205
def sub (
3205
3206
self : Series [Never ],
3206
3207
other : complex | NumListLike | Index [T_COMPLEX ] | Series [T_COMPLEX ],
@@ -4623,6 +4624,22 @@ class Series(IndexOpsMixin[S1], NDFrame):
4623
4624
** kwargs ,
4624
4625
) -> np_1darray [GenericT ]: ...
4625
4626
@overload
4627
+ def to_numpy (
4628
+ self : Series [Period ],
4629
+ dtype : None = None ,
4630
+ copy : bool = False ,
4631
+ na_value : Scalar = ...,
4632
+ ** kwargs ,
4633
+ ) -> np_1darray [np .object_ ]: ...
4634
+ @overload
4635
+ def to_numpy (
4636
+ self : Series [Period ],
4637
+ dtype : type [np .int64 ],
4638
+ copy : bool = False ,
4639
+ na_value : Scalar = ...,
4640
+ ** kwargs ,
4641
+ ) -> np_1darray [np .int64 ]: ...
4642
+ @overload
4626
4643
def to_numpy ( # pyright: ignore[reportIncompatibleMethodOverride]
4627
4644
self ,
4628
4645
dtype : DTypeLike | None = None ,
@@ -4716,15 +4733,10 @@ class _SeriesSubclassBase(Series[S1], Generic[S1, GenericT_co]):
4716
4733
** kwargs ,
4717
4734
) -> np_1darray : ...
4718
4735
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
4736
4725
4737
class OffsetSeries (_SeriesSubclassBase [BaseOffset , np .object_ ]):
4726
4738
@overload # type: ignore[override]
4727
- def __radd__ (self , other : Period ) -> PeriodSeries : ...
4739
+ def __radd__ (self , other : Period ) -> Series [ Period ] : ...
4728
4740
@overload
4729
4741
def __radd__ ( # pyright: ignore[reportIncompatibleMethodOverride]
4730
4742
self , other : BaseOffset
0 commit comments