Skip to content

Commit c7f41f6

Browse files
add test for pandas-dev#35369
1 parent 2081d43 commit c7f41f6

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

pandas/tests/indexing/test_indexing.py

+10
Original file line numberDiff line numberDiff line change
@@ -1100,3 +1100,13 @@ def test_long_text_missing_labels_inside_loc_error_message_limited():
11001100
error_message_regex = "long_missing_label_text_0.*\\\\n.*long_missing_label_text_1"
11011101
with pytest.raises(KeyError, match=error_message_regex):
11021102
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

Comments
 (0)