pandas.Categorical.remove_unused_categories
pandas 3.1.1 · Arrays, scalars, and data types · method
Remove declared categories that do not occur in the data.
Call syntax
Categorical.remove_unused_categories()Run the example
Edit the example and select Run Python to see the result.
Parameters
This call takes no arguments.
Returns
Categorical