diff --git a/pandas-stubs/core/series.pyi b/pandas-stubs/core/series.pyi index 469d44ea0..6188024ef 100644 --- a/pandas-stubs/core/series.pyi +++ b/pandas-stubs/core/series.pyi @@ -1789,7 +1789,7 @@ class Series(IndexOpsMixin[S1], ElementOpsMixin[S1], NDFrame): # just failed to generate these so I couldn't match # them up. @overload - def __add__(self: Series[Never], other: complex | ListLike) -> Series: ... + def __add__(self: Series[Never], other: _str | complex | ListLike) -> Series: ... @overload def __add__(self, other: Index[Never] | Series[Never]) -> Series: ... @overload diff --git a/tests/series/test_series.py b/tests/series/test_series.py index 33eee7915..b6f82ed10 100644 --- a/tests/series/test_series.py +++ b/tests/series/test_series.py @@ -4080,3 +4080,11 @@ def test_series_index_setter() -> None: check(assert_type(sr.index, pd.Index), pd.Index) sr.index = [2, 3] check(assert_type(sr.index, pd.Index), pd.Index) + + +def test_series_add_str() -> None: + """Test Series.__add__ with Series[Any].""" + df = pd.DataFrame({0: ["a", "b"]}) + sr = df[0] + + check(assert_type(sr + "c1", pd.Series), pd.Series, str)