@@ -62,7 +62,10 @@ from pandas.core.window.rolling import (
62
62
Rolling ,
63
63
Window ,
64
64
)
65
- from typing_extensions import TypeAlias
65
+ from typing_extensions import (
66
+ Never ,
67
+ TypeAlias ,
68
+ )
66
69
import xarray as xr
67
70
68
71
from pandas ._libs .missing import NAType
@@ -467,8 +470,9 @@ class Series(IndexOpsMixin, NDFrame, Generic[S1]):
467
470
observed : _bool = ...,
468
471
dropna : _bool = ...,
469
472
) -> _SeriesGroupByNonScalar [S1 ]: ...
473
+ # need the ignore because None is Hashable
470
474
@overload
471
- def count (self , level : None = ...) -> int : ...
475
+ def count (self , level : None = ...) -> int : ... # type: ignore[misc]
472
476
@overload
473
477
def count (self , level : Hashable ) -> Series [S1 ]: ...
474
478
def mode (self , dropna = ...) -> Series [S1 ]: ...
@@ -1222,7 +1226,7 @@ class Series(IndexOpsMixin, NDFrame, Generic[S1]):
1222
1226
def __add__ (self , other : Timestamp ) -> TimestampSeries : ...
1223
1227
@overload
1224
1228
def __add__ (
1225
- self , other : num | _str | Timedelta | _ListLike | Series [S1 ]
1229
+ self , other : num | _str | Timedelta | _ListLike | Series [S1 ] | np . timedelta64
1226
1230
) -> Series : ...
1227
1231
# ignore needed for mypy as we want different results based on the arguments
1228
1232
@overload
@@ -1254,7 +1258,9 @@ class Series(IndexOpsMixin, NDFrame, Generic[S1]):
1254
1258
def __le__ (self , other : S1 | _ListLike | Series [S1 ]) -> Series [_bool ]: ...
1255
1259
def __lt__ (self , other : S1 | _ListLike | Series [S1 ]) -> Series [_bool ]: ...
1256
1260
@overload
1257
- def __mul__ (self , other : Timedelta | TimedeltaSeries ) -> TimedeltaSeries : ...
1261
+ def __mul__ (
1262
+ self , other : Timedelta | TimedeltaSeries | np .timedelta64
1263
+ ) -> TimedeltaSeries : ...
1258
1264
@overload
1259
1265
def __mul__ (self , other : num | _ListLike | Series ) -> Series : ...
1260
1266
def __mod__ (self , other : num | _ListLike | Series [S1 ]) -> Series [S1 ]: ...
@@ -1315,17 +1321,19 @@ class Series(IndexOpsMixin, NDFrame, Generic[S1]):
1315
1321
) -> TimedeltaSeries : ...
1316
1322
@overload
1317
1323
def __sub__ (
1318
- self : Series [Timestamp ], other : Timedelta | TimedeltaSeries | TimedeltaIndex
1324
+ self : Series [Timestamp ],
1325
+ other : Timedelta | TimedeltaSeries | TimedeltaIndex | np .timedelta64 ,
1319
1326
) -> TimestampSeries : ...
1320
1327
@overload
1321
1328
def __sub__ (
1322
- self : Series [Timedelta ], other : Timedelta | TimedeltaSeries | TimedeltaIndex
1329
+ self : Series [Timedelta ],
1330
+ other : Timedelta | TimedeltaSeries | TimedeltaIndex | np .timedelta64 ,
1323
1331
) -> TimedeltaSeries : ...
1324
1332
@overload
1325
1333
def __sub__ (self , other : num | _ListLike | Series ) -> Series : ...
1326
1334
@overload
1327
1335
def __truediv__ (
1328
- self , other : Timedelta | TimedeltaSeries | TimedeltaIndex
1336
+ self , other : Timedelta | TimedeltaSeries | TimedeltaIndex | np . timedelta64
1329
1337
) -> Series [float ]: ...
1330
1338
@overload
1331
1339
def __truediv__ (self , other : num | _ListLike | Series [S1 ]) -> Series : ...
@@ -1750,6 +1758,14 @@ class TimestampSeries(Series[Timestamp]):
1750
1758
# ignore needed because of mypy
1751
1759
@property
1752
1760
def dt (self ) -> TimestampProperties : ... # type: ignore[override]
1761
+ @overload # type: ignore[override]
1762
+ def __add__ (
1763
+ self , other : TimedeltaSeries | np .timedelta64 | TimestampSeries
1764
+ ) -> TimestampSeries : ...
1765
+ @overload
1766
+ def __add__ (self , other : Timestamp ) -> Never : ...
1767
+ def __mul__ (self , other : TimestampSeries | np .timedelta64 | TimedeltaSeries ) -> Never : ... # type: ignore[override]
1768
+ def __truediv__ (self , other : TimestampSeries | np .timedelta64 | TimedeltaSeries ) -> Never : ... # type: ignore[override]
1753
1769
1754
1770
class TimedeltaSeries (Series [Timedelta ]):
1755
1771
# ignores needed because of mypy
@@ -1758,12 +1774,18 @@ class TimedeltaSeries(Series[Timedelta]):
1758
1774
@overload
1759
1775
def __add__ (self , other : Timestamp | DatetimeIndex ) -> TimestampSeries : ...
1760
1776
@overload
1761
- def __add__ (self , other : Timedelta ) -> TimedeltaSeries : ...
1777
+ def __add__ (self , other : Timedelta | np . timedelta64 ) -> TimedeltaSeries : ...
1762
1778
def __radd__ (self , pther : Timestamp | TimestampSeries ) -> TimestampSeries : ... # type: ignore[override]
1763
- def __mul__ (self , other : num ) -> TimedeltaSeries : ... # type: ignore[override]
1779
+ @overload # type: ignore[override]
1780
+ def __mul__ (
1781
+ self , other : TimestampSeries | np .timedelta64 | Timedelta | TimedeltaSeries
1782
+ ) -> Never : ...
1783
+ @overload
1784
+ def __mul__ (self , other : num ) -> TimedeltaSeries : ...
1764
1785
def __sub__ ( # type: ignore[override]
1765
- self , other : Timedelta | TimedeltaSeries | TimedeltaIndex
1786
+ self , other : Timedelta | TimedeltaSeries | TimedeltaIndex | np . timedelta64
1766
1787
) -> TimedeltaSeries : ...
1788
+ def __truediv__ (self , other : TimedeltaSeries | np .timedelta64 | TimedeltaIndex ) -> Series [float ]: ... # type: ignore[override]
1767
1789
@property
1768
1790
def dt (self ) -> TimedeltaProperties : ... # type: ignore[override]
1769
1791
0 commit comments