Skip to content

Commit e1b6cbf

Browse files
JarnoRFBjorisvandenbossche
authored andcommitted
DOC: Fix renaming categories section (#21264)
The categories were not correctly saved so that the renaming using the dict-like object had no effect.
1 parent bc9241d commit e1b6cbf

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

doc/source/categorical.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -358,10 +358,10 @@ Renaming categories is done by assigning new values to the
358358
s
359359
s.cat.categories = ["Group %s" % g for g in s.cat.categories]
360360
s
361-
s.cat.rename_categories([1,2,3])
361+
s = s.cat.rename_categories([1,2,3])
362362
s
363363
# You can also pass a dict-like object to map the renaming
364-
s.cat.rename_categories({1: 'x', 2: 'y', 3: 'z'})
364+
s = s.cat.rename_categories({1: 'x', 2: 'y', 3: 'z'})
365365
s
366366
367367
.. note::

0 commit comments

Comments
 (0)