Closed
Description
(From master
)
import pandas as pd
idx = pd.to_datetime(["2020-01-01", None])
idx.map(lambda x: pd.Timestamp("1999-01-01"), na_action="ignore")
# DatetimeIndex(['1999-01-01', '1999-01-01'], dtype='datetime64[ns]', freq=None)
idx = pd.CategoricalIndex(["a", None], categories=["a"])
idx.map(lambda x: x, na_action="ignore")
# TypeError: map() got an unexpected keyword argument 'na_action'
In the DatetimeIndex
case idx.map
should propagate the null value instead of returning Timestamp("1999-01-01")
since na_action == "ignore"
, and although it isn't documented I think CategoricalIndex.map
should allow na_action
since the other map
methods do.