pandas.CategoricalIndex.rename_categories
pandas 3.1.1 · Index objects · method
Change the labels of categories and preserve the underlying assignments.
Call syntax
CategoricalIndex.rename_categories(new_categories)Run the example
Edit the example and select Run Python to see the result.
Parameters
| Parameter | Requirement | Accepted values and behavior |
|---|---|---|
new_categories |
Required Positional or keyword |
list-like, dict-like or callable Provide the category labels to add, assign, or reorder. |
Returns
CategoricalIndex