pandas.DataFrame.map

pandas 3.1.1 · DataFrame · method

Apply a scalar-to-scalar callable cell by cell. Use na_action="ignore" to skip missing cells.

Call syntax

DataFrame.map(func, na_action=None, **kwargs)

Run the example

Edit the example and select Run Python to see the result.

Parameters

ParameterRequirementAccepted values and behavior
func Required
Positional or keyword
callable

Supply a supported operation name or a callable, depending on this API.

na_action Optional
Positional or keyword
Default None
{None, 'ignore'}

Control how the mapper treats missing inputs.

**kwargs Optional
Additional keyword arguments

Returns

DataFrame