-
-
Notifications
You must be signed in to change notification settings - Fork 19.4k
Open
Labels
ApplyApply, Aggregate, Transform, MapApply, Aggregate, Transform, MapBugNA - MaskedArraysRelated to pd.NA and nullable extension arraysRelated to pd.NA and nullable extension arrays
Description
Pandas version checks
-
I have checked that this issue has not already been reported.
-
I have confirmed this bug exists on the latest version of pandas.
-
I have confirmed this bug exists on the main branch of pandas.
Reproducible Example
s = pd.Series([1, 2, None], dtype="Int32")
s.apply(lambda x: print(x))
s.map(lambda x: print(x))
# print 1.0 2.0 nan instead of 1 2 <NA>Issue Description
s has dtype Int32Dtype which can encode nullable integers
However, when we use .apply(f) or .map(f), the element passed to f becomes float, and pd.NA becomes np.nan
Expected Behavior
f should receive unconverted value, as if we are doing f(s.iloc[0]), f(s.iloc[1]), ...
Installed Versions
tested with Pandas 2.2.3
Metadata
Metadata
Assignees
Labels
ApplyApply, Aggregate, Transform, MapApply, Aggregate, Transform, MapBugNA - MaskedArraysRelated to pd.NA and nullable extension arraysRelated to pd.NA and nullable extension arrays