We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 2081d43 commit c7f41f6Copy full SHA for c7f41f6
pandas/tests/indexing/test_indexing.py
@@ -1100,3 +1100,13 @@ def test_long_text_missing_labels_inside_loc_error_message_limited():
1100
error_message_regex = "long_missing_label_text_0.*\\\\n.*long_missing_label_text_1"
1101
with pytest.raises(KeyError, match=error_message_regex):
1102
s.loc[["a", "c"] + missing_labels]
1103
+
1104
1105
+def test_setitem_categorical():
1106
+ # https://github.com/pandas-dev/pandas/issues/35369
1107
+ df = pd.DataFrame({"h": pd.Series(list("mn")).astype("category")})
1108
+ df.h = df.h.cat.reorder_categories(["n", "m"])
1109
+ expected = pd.DataFrame(
1110
+ {"h": pd.Categorical(["m", "n"]).reorder_categories(["n", "m"])}
1111
+ )
1112
+ tm.assert_frame_equal(df, expected)
0 commit comments