Skip to content
Merged
Show file tree
Hide file tree
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
6 changes: 6 additions & 0 deletions pandas-stubs/core/series.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -965,6 +965,12 @@ class Series(IndexOpsMixin[S1], NDFrame):
na_action: None = ...,
) -> Series[S2]: ...
@overload
def map(
self,
arg: Callable[[Any], Any] | Mapping[Any, Any] | UnknownSeries,
na_action: Literal["ignore"] | None = ...,
) -> UnknownSeries: ...
@overload
def aggregate(
self: Series[int],
func: Literal["mean"],
Expand Down
6 changes: 6 additions & 0 deletions tests/test_series.py
Original file line number Diff line number Diff line change
Expand Up @@ -3390,6 +3390,12 @@ def callable(x: int) -> str:
assert_type(s.map(series, na_action="ignore"), "pd.Series[str]"), pd.Series, str
)

unknown_series = pd.Series([1, 0, None])
check(
assert_type(unknown_series.map({1: True, 0: False, None: None}), "pd.Series"),
pd.Series,
)


def test_map_na() -> None:
s: pd.Series[int] = pd.Series([1, pd.NA, 3])
Expand Down