pandas.Categorical.add_categories
pandas 3.1.1 · Arrays, scalars, and data types · method
Extend the list of permitted categories without changing observations.
Call syntax
Categorical.add_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 |
category or list-like of category Provide the category labels to add, assign, or reorder. |
Returns
Categorical