Skip to content

Commit

Permalink
code sample for pandas-dev#43232
Browse files Browse the repository at this point in the history
  • Loading branch information
simonjayhawkins committed Aug 27, 2021
1 parent 03b7211 commit 79b3d45
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions bisect/43232.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# BUG: reorder_categories with inplace=True is not changing the dtype.categories #43232

import pandas as pd

print(pd.__version__)

sr = pd.Series(["a", "b", "c"], dtype="category")

sr.cat.reorder_categories(["c", "b", "a"], inplace=True)
print(sr)

result = sr.dtype.categories
expected = pd.Index(["c", "b", "a"], dtype="object")
pd.testing.assert_index_equal(result, expected)

0 comments on commit 79b3d45

Please sign in to comment.