Skip to content

Commit 14f610c

Browse files
committed
Fix Series.map default for na_action
1 parent b82986c commit 14f610c

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

pandas-stubs/core/series.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1107,7 +1107,7 @@ class Series(IndexOpsMixin[S1], ElementOpsMixin[S1], NDFrame):
11071107
def map(
11081108
self,
11091109
arg: Callable[[S1], S2 | NAType] | Mapping[S1, S2] | Series[S2],
1110-
na_action: Literal["ignore"] = ...,
1110+
na_action: Literal["ignore"],
11111111
) -> Series[S2]: ...
11121112
@overload
11131113
def map(
@@ -1119,7 +1119,7 @@ class Series(IndexOpsMixin[S1], ElementOpsMixin[S1], NDFrame):
11191119
def map(
11201120
self,
11211121
arg: Callable[[Any], Any] | Mapping[Any, Any] | Series,
1122-
na_action: Literal["ignore"] | None = ...,
1122+
na_action: Literal["ignore"] | None = None,
11231123
) -> Series: ...
11241124
@overload
11251125
def aggregate(

tests/series/test_series.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3620,6 +3620,8 @@ def callable(x: int | NAType) -> str | NAType:
36203620
check(
36213621
assert_type(s.map(callable, na_action=None), "pd.Series[str]"), pd.Series, str
36223622
)
3623+
# na_action defaults to None
3624+
check(assert_type(s.map(callable), "pd.Series[str]"), pd.Series, str)
36233625

36243626
series = pd.Series(["a", "b", "c"])
36253627
check(assert_type(s.map(series, na_action=None), "pd.Series[str]"), pd.Series, str)

0 commit comments

Comments
 (0)