dask.dataframe.Series.cat.reorder_categories

dask.dataframe.Series.cat.reorder_categories

dataframe.Series.cat.reorder_categories(*args, **kwargs)

Reorder categories as specified in new_categories.

This docstring was copied from pandas.core.arrays.categorical.CategoricalAccessor.reorder_categories.

Some inconsistencies with the Dask version may exist.

new_categories need to include all old categories and no new category items.

Parameters
new_categoriesIndex-like

The categories in new order.

orderedbool, optional

Whether or not the categorical is treated as a ordered categorical. If not given, do not change the ordered information.

Returns
Categorical

Categorical with reordered categories.

Raises
ValueError

If the new categories do not contain all old category items or any new ones

See also

rename_categories

Rename categories.

add_categories

Add new categories.

remove_categories

Remove the specified categories.

remove_unused_categories

Remove categories which are not used.

set_categories

Set the categories to the specified ones.