Skip to content

Commit a56a50c

Browse files
GH1541 Revert Series[Any].__add__(str)
1 parent ffa2396 commit a56a50c

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

pandas-stubs/core/series.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1789,7 +1789,7 @@ class Series(IndexOpsMixin[S1], ElementOpsMixin[S1], NDFrame):
17891789
# just failed to generate these so I couldn't match
17901790
# them up.
17911791
@overload
1792-
def __add__(self: Series[Never], other: complex | ListLike) -> Series: ...
1792+
def __add__(self: Series[Never], other: _str | complex | ListLike) -> Series: ...
17931793
@overload
17941794
def __add__(self, other: Index[Never] | Series[Never]) -> Series: ...
17951795
@overload

tests/series/test_series.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4080,3 +4080,11 @@ def test_series_index_setter() -> None:
40804080
check(assert_type(sr.index, pd.Index), pd.Index)
40814081
sr.index = [2, 3]
40824082
check(assert_type(sr.index, pd.Index), pd.Index)
4083+
4084+
4085+
def test_series_add_str() -> None:
4086+
"""Test Series.__add__ with Series[Any]."""
4087+
df = pd.DataFrame({0: ["a", "b"]})
4088+
sr = df[0]
4089+
4090+
check(assert_type(sr.__add__("c1"), pd.Series), pd.Series, str)

0 commit comments

Comments
 (0)