pandas.Series.cat.add_categories¶
- Series.cat.add_categories(*args, **kwargs)[source]¶
Add new categories.
new_categories will be included at the last/highest place in the categories and will be unused directly after this call.
- Parameters
- new_categoriescategory or list-like of category
The new categories to be included.
- inplacebool, default False
Whether or not to add the categories inplace or return a copy of this categorical with added categories.
Deprecated since version 1.3.0.
- Returns
- catCategorical or None
Categorical with new categories added or None if
inplace=True.
- Raises
- ValueError
If the new categories include old categories or do not validate as categories
See also
rename_categoriesRename categories.
reorder_categoriesReorder categories.
remove_categoriesRemove the specified categories.
remove_unused_categoriesRemove categories which are not used.
set_categoriesSet the categories to the specified ones.