CategoricalIndex.rename_categories()
pandas.CategoricalIndex.rename_categories
-
CategoricalIndex.rename_categories(*args, **kwargs)
-
Renames categories.
The new categories has to be a list-like object. All items must be unique and the number of items in the new categories must be the same as the number of items in the old categories.
Parameters: new_categories : Index-like
The renamed categories.
inplace : boolean (default: False)
Whether or not to rename the categories inplace or return a copy of this categorical with renamed categories.
Returns: cat : Categorical with renamed categories added or None if inplace.
Raises: ValueError
If the new categories do not have the same number of items than the current categories or do not validate as categories
© 2011–2012 Lambda Foundry, Inc. and PyData Development Team
© 2008–2011 AQR Capital Management, LLC
© 2008–2014 the pandas development team
Licensed under the 3-clause BSD License.
http://pandas.pydata.org/pandas-docs/version/0.18.1/generated/pandas.CategoricalIndex.rename_categories.html