Series.cat.reorder_categories()
pandas.Series.cat.reorder_categories
-
Series.cat.reorder_categories(*args, **kwargs)
-
Reorders categories as specified in new_categories.
new_categories
need to include all old categories and no new category items.Parameters: new_categories : Index-like
The categories in new order.
ordered : boolean, optional
Whether or not the categorical is treated as a ordered categorical. If not given, do not change the ordered information.
inplace : boolean (default: False)
Whether or not to reorder the categories inplace or return a copy of this categorical with reordered categories.
Returns: cat : Categorical with reordered categories or None if inplace.
Raises: ValueError
If the new categories do not contain all old category items or any new ones
© 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.Series.cat.reorder_categories.html