Skip to content

Commit eee7968

Browse files
dwhuTomAugspurger
authored andcommitted
TST: Adding Test for merge_asof groupby=multiple with categorical column. (#30653)
1 parent 45d8d77 commit eee7968

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

pandas/tests/reshape/merge/test_merge_asof.py

+7
Original file line numberDiff line numberDiff line change
@@ -1185,6 +1185,13 @@ def test_merge_datatype_categorical_error_raises(self):
11851185
with pytest.raises(MergeError, match=msg):
11861186
merge_asof(left, right, on="a")
11871187

1188+
def test_merge_groupby_multiple_column_with_categorical_column(self):
1189+
# GH 16454
1190+
df = pd.DataFrame({"x": [0], "y": [0], "z": pd.Categorical([0])})
1191+
result = merge_asof(df, df, on="x", by=["y", "z"])
1192+
expected = pd.DataFrame({"x": [0], "y": [0], "z": pd.Categorical([0])})
1193+
tm.assert_frame_equal(result, expected)
1194+
11881195
@pytest.mark.parametrize(
11891196
"func", [lambda x: x, lambda x: to_datetime(x)], ids=["numeric", "datetime"]
11901197
)

0 commit comments

Comments
 (0)