CategoricalIndex.add_categories(self, *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.

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.

catCategorical with new categories added or None if inplace.

If the new categories include old categories or do not validate as categories

Scroll To Top