Skip to content

Feature request: add na_action argument to applymap #23803

Closed
@gwerbin

Description

@gwerbin

Code Sample, a copy-pastable example if possible

Desired method:

x = pd.DataFrame(...)
x = x.applymap(foo, na_action='ignore')

Current method:

x = pd.DataFrame(...)
x = x.apply(lambda y: y.map(foo, na_action='ignore'))

Problem description

The na_action='ignore' argument is extremely useful when processing messy data, and it would be nice to have on the DataFrame.applymap method as well.

DataFrame.applymap already uses very similar code, so ideally this shouldn't be too dramatic of a change.

DataFrame.applymap
Series.map (1), Series.map (2)

For that matter, is there any reason why DataFrame.applymap shouldn't just be a wrapper for .apply(lambda x: Series.map)? Seems like it would be beneficial for deduplicating logic in the codebase anyway.

Metadata

Metadata

Assignees

No one assigned

    Labels

    EnhancementMissing-datanp.nan, pd.NaT, pd.NA, dropna, isnull, interpolate

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions