Skip to content

[Issue #461] Added timedelta as a diviser option for Timemedeltaseries #463

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 24 additions & 5 deletions pandas-stubs/core/series.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -683,6 +683,7 @@ class Series(IndexOpsMixin, NDFrame, Generic[S1]):
**kwargs,
) -> Series[S1]: ...
agg = aggregate

@overload
def transform(
self,
Expand Down Expand Up @@ -926,6 +927,7 @@ class Series(IndexOpsMixin, NDFrame, Generic[S1]):
@property
def plot(self) -> PlotAccessor: ...
sparse = ...

def hist(
self,
by: object | None = ...,
Expand Down Expand Up @@ -1230,6 +1232,7 @@ class Series(IndexOpsMixin, NDFrame, Generic[S1]):
self, other: num | _str | Timedelta | _ListLike | Series[S1] | np.timedelta64
) -> Series: ...
# ignore needed for mypy as we want different results based on the arguments

@overload
def __and__( # type: ignore[misc]
self, other: bool | list[bool] | np_ndarray_bool | Series[bool]
Expand Down Expand Up @@ -1268,6 +1271,7 @@ class Series(IndexOpsMixin, NDFrame, Generic[S1]):
def __ne__(self, other: object) -> Series[_bool]: ... # type: ignore[override]
def __pow__(self, other: num | _ListLike | Series[S1]) -> Series[S1]: ...
# ignore needed for mypy as we want different results based on the arguments

@overload
def __or__( # type: ignore[misc]
self, other: bool | list[bool] | np_ndarray_bool | Series[bool]
Expand All @@ -1278,6 +1282,7 @@ class Series(IndexOpsMixin, NDFrame, Generic[S1]):
) -> Series[int]: ...
def __radd__(self, other: num | _str | _ListLike | Series[S1]) -> Series[S1]: ...
# ignore needed for mypy as we want different results based on the arguments

@overload
def __rand__( # type: ignore[misc]
self, other: bool | list[bool] | np_ndarray_bool | Series[bool]
Expand All @@ -1294,6 +1299,7 @@ class Series(IndexOpsMixin, NDFrame, Generic[S1]):
def __rnatmul__(self, other: num | _ListLike | Series[S1]) -> Series[S1]: ...
def __rpow__(self, other: num | _ListLike | Series[S1]) -> Series[S1]: ...
# ignore needed for mypy as we want different results based on the arguments

@overload
def __ror__( # type: ignore[misc]
self, other: bool | list[bool] | np_ndarray_bool | Series[bool]
Expand All @@ -1308,6 +1314,7 @@ class Series(IndexOpsMixin, NDFrame, Generic[S1]):
@overload
def __rtruediv__(self, other: num | _ListLike | Series[S1]) -> Series: ...
# ignore needed for mypy as we want different results based on the arguments

@overload
def __rxor__( # type: ignore[misc]
self, other: bool | list[bool] | np_ndarray_bool | Series[bool]
Expand Down Expand Up @@ -1339,6 +1346,7 @@ class Series(IndexOpsMixin, NDFrame, Generic[S1]):
@overload
def __truediv__(self, other: num | _ListLike | Series[S1]) -> Series: ...
# ignore needed for mypy as we want different results based on the arguments

@overload
def __xor__( # type: ignore[misc]
self, other: bool | list[bool] | np_ndarray_bool | Series[bool]
Expand All @@ -1362,6 +1370,7 @@ class Series(IndexOpsMixin, NDFrame, Generic[S1]):
@property
def loc(self) -> _LocIndexerSeries[S1]: ...
# Methods

def add(
self,
other: Series[S1] | Scalar,
Expand Down Expand Up @@ -1765,8 +1774,12 @@ class TimestampSeries(Series[Timestamp]):
) -> TimestampSeries: ...
@overload
def __add__(self, other: Timestamp) -> Never: ...
def __mul__(self, other: TimestampSeries | np.timedelta64 | TimedeltaSeries) -> Never: ... # type: ignore[override]
def __truediv__(self, other: TimestampSeries | np.timedelta64 | TimedeltaSeries) -> Never: ... # type: ignore[override]
def __mul__(
self, other: TimestampSeries | np.timedelta64 | TimedeltaSeries
) -> Never: ... # type: ignore[override]
def __truediv__(
self, other: TimestampSeries | np.timedelta64 | TimedeltaSeries
) -> Never: ... # type: ignore[override]

class TimedeltaSeries(Series[Timedelta]):
# ignores needed because of mypy
Expand All @@ -1776,7 +1789,9 @@ class TimedeltaSeries(Series[Timedelta]):
def __add__(self, other: Timestamp | DatetimeIndex) -> TimestampSeries: ...
@overload
def __add__(self, other: Timedelta | np.timedelta64) -> TimedeltaSeries: ...
def __radd__(self, pther: Timestamp | TimestampSeries) -> TimestampSeries: ... # type: ignore[override]
def __radd__(
self, pther: Timestamp | TimestampSeries
) -> TimestampSeries: ... # type: ignore[override]
@overload # type: ignore[override]
def __mul__(
self, other: TimestampSeries | np.timedelta64 | Timedelta | TimedeltaSeries
Expand All @@ -1786,15 +1801,19 @@ class TimedeltaSeries(Series[Timedelta]):
def __sub__( # type: ignore[override]
self, other: Timedelta | TimedeltaSeries | TimedeltaIndex | np.timedelta64
) -> TimedeltaSeries: ...
def __truediv__(self, other: TimedeltaSeries | np.timedelta64 | TimedeltaIndex) -> Series[float]: ... # type: ignore[override]
def __truediv__(
self, other: TimedeltaSeries | np.timedelta64 | TimedeltaIndex | Timedelta
) -> Series[float]: ... # type: ignore[override]
@property
def dt(self) -> TimedeltaProperties: ... # type: ignore[override]

class PeriodSeries(Series[Period]):
# ignore needed because of mypy
@property
def dt(self) -> PeriodProperties: ... # type: ignore[override]
def __sub__(self, other: PeriodSeries) -> OffsetSeries: ... # type: ignore[override]
def __sub__(
self, other: PeriodSeries
) -> OffsetSeries: ... # type: ignore[override]

class OffsetSeries(Series):
@overload # type: ignore[override]
Expand Down