original) (raw)
(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")
idx = pd.CategoricalIndex(["a", None], categories=["a"]) idx.map(lambda x: x, na_action="ignore")
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.