Skip to content

Commit b212672

Browse files
authored
Update docstring on rename_categories
1 parent 0b05663 commit b212672

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

pandas/core/categorical.py

+7-6
Original file line numberDiff line numberDiff line change
@@ -793,19 +793,20 @@ def set_categories(self, new_categories, ordered=None, rename=False,
793793
def rename_categories(self, new_categories, inplace=False):
794794
""" Renames categories.
795795
796-
The new categories has to be a list-like object. All items must be
797-
unique and the number of items in the new categories must be the same
798-
as the number of items in the old categories.
796+
The new categories can be either a list-like dict-like object.
797+
If it is list-like, all items must be unique and the number of items
798+
in the new categories must be the same as the number of items in the
799+
old categories.
799800
800801
Raises
801802
------
802803
ValueError
803-
If the new categories do not have the same number of items than the
804-
current categories or do not validate as categories
804+
If new categories are list-like and do not have the same number of
805+
items than the current categories or do not validate as categories
805806
806807
Parameters
807808
----------
808-
new_categories : Index-like
809+
new_categories : Index-like or Dict-like
809810
The renamed categories.
810811
inplace : boolean (default: False)
811812
Whether or not to rename the categories inplace or return a copy of

0 commit comments

Comments
 (0)