Skip to content

Commit 3c6f490

Browse files
GH1089 Fix pow operator on Series[int] with float exponent
1 parent 6e496ae commit 3c6f490

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

pandas-stubs/core/series.pyi

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1894,6 +1894,15 @@ class Series(IndexOpsMixin[S1], NDFrame):
18941894
axis: AxisIndex = ...,
18951895
) -> Series[_bool]: ...
18961896
def nunique(self, dropna: _bool = ...) -> int: ...
1897+
@overload
1898+
def pow(
1899+
self: Series[int],
1900+
other: float,
1901+
level: Level | None = ...,
1902+
fill_value: float | None = ...,
1903+
axis: AxisIndex | None = ...,
1904+
) -> Series[float]: ...
1905+
@overload
18971906
def pow(
18981907
self,
18991908
other: num | _ListLike | Series[S1],

tests/test_series.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -714,7 +714,7 @@ def test_types_scalar_arithmetic() -> None:
714714
check(assert_type(s**2, "pd.Series[int]"), pd.Series, np.integer)
715715
check(assert_type(s**0, "pd.Series[int]"), pd.Series, np.integer)
716716
check(assert_type(s**0.213, "pd.Series[int]"), pd.Series, np.float64)
717-
check(assert_type(s.pow(0.5), "pd.Series[int]"), pd.Series, np.float64)
717+
check(assert_type(s.pow(0.5), "pd.Series[float]"), pd.Series, np.float64)
718718

719719

720720
# GH 103

0 commit comments

Comments
 (0)