Skip to content

Commit 79b3d45

Browse files
code sample for pandas-dev#43232
1 parent 03b7211 commit 79b3d45

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

bisect/43232.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# BUG: reorder_categories with inplace=True is not changing the dtype.categories #43232
2+
3+
import pandas as pd
4+
5+
print(pd.__version__)
6+
7+
sr = pd.Series(["a", "b", "c"], dtype="category")
8+
9+
sr.cat.reorder_categories(["c", "b", "a"], inplace=True)
10+
print(sr)
11+
12+
result = sr.dtype.categories
13+
expected = pd.Index(["c", "b", "a"], dtype="object")
14+
pd.testing.assert_index_equal(result, expected)

0 commit comments

Comments
 (0)