pandas.CategoricalIndex.map

pandas 3.1.1 · Index objects · method

Apply a substitution or callable to individual values. The receiver determines which mappers it supports.

Call syntax

CategoricalIndex.map(mapper, na_action=None)

Run the example

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

Parameters

ParameterRequirementAccepted values and behavior
mapper Required
Positional or keyword
function, dict, or Series

Provide a dictionary or callable that maps input values or labels.

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

Control how the mapper treats missing inputs.

Returns

pandas.CategoricalIndex or pandas.Index