pandas.Index.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
Index.map(mapper, na_action=None)Run the example
Edit the example and select Run Python to see the result.
Parameters
| Parameter | Requirement | Accepted 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
Union[Index, MultiIndex]