Series.cat.rename_categories(self, *args, **kwargs) [source]
Rename categories.
| Parameters: | 
  |  
|---|---|
| Returns: | 
  |  
| Raises: | 
  |  
See also
>>> c = pd.Categorical(['a', 'a', 'b']) >>> c.rename_categories([0, 1]) [0, 0, 1] Categories (2, int64): [0, 1]
For dict-like new_categories, extra keys are ignored and categories not in the dictionary are passed through
>>> c.rename_categories({'a': 'A', 'c': 'C'})
[A, A, b]
Categories (2, object): [A, b]
 You may also provide a callable to create the new categories
>>> c.rename_categories(lambda x: x.upper()) [A, A, B] Categories (2, object): [A, B]
    © 2008–2012, AQR Capital Management, LLC, Lambda Foundry, Inc. and PyData Development Team
Licensed under the 3-clause BSD License.
    https://pandas.pydata.org/pandas-docs/version/0.25.0/reference/api/pandas.Series.cat.rename_categories.html