diff --git a/pandas-stubs/core/series.pyi b/pandas-stubs/core/series.pyi index 6b1cf01b..838ac6b3 100644 --- a/pandas-stubs/core/series.pyi +++ b/pandas-stubs/core/series.pyi @@ -940,7 +940,9 @@ class Series(IndexOpsMixin[S1], NDFrame): @overload def apply( self, - func: Callable[..., Scalar | Sequence | set | Mapping | NAType | None], + func: Callable[ + ..., Scalar | Sequence | set | Mapping | NAType | frozenset | None + ], convertDType: _bool = ..., args: tuple = ..., **kwds, diff --git a/tests/test_series.py b/tests/test_series.py index ea6110ec..d34cc3c4 100644 --- a/tests/test_series.py +++ b/tests/test_series.py @@ -3083,3 +3083,11 @@ def first_arg_not_series(argument_1: int, ser: pd.Series) -> pd.Series: ), 1, ) + + +def test_series_apply() -> None: + s = pd.Series(["A", "B", "AB"]) + check(assert_type(s.apply(tuple), "pd.Series[Any]"), pd.Series) + check(assert_type(s.apply(list), "pd.Series[Any]"), pd.Series) + check(assert_type(s.apply(set), "pd.Series[Any]"), pd.Series) + check(assert_type(s.apply(frozenset), "pd.Series[Any]"), pd.Series)