Skip to content

Commit 85e3fbd

Browse files
keechongtanproost
authored andcommitted
TST: Test Groupby with Categoricals consistent for Series and DataFrame results (pandas-dev#29343)
1 parent 2629c5a commit 85e3fbd

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

pandas/tests/groupby/test_categorical.py

+7
Original file line numberDiff line numberDiff line change
@@ -1193,6 +1193,13 @@ def test_seriesgroupby_observed_apply_dict(df_cat, observed, index, data):
11931193
tm.assert_series_equal(result, expected)
11941194

11951195

1196+
def test_groupby_categorical_series_dataframe_consistent(df_cat):
1197+
# GH 20416
1198+
expected = df_cat.groupby(["A", "B"])["C"].mean()
1199+
result = df_cat.groupby(["A", "B"]).mean()["C"]
1200+
tm.assert_series_equal(result, expected)
1201+
1202+
11961203
@pytest.mark.parametrize("code", [([1, 0, 0]), ([0, 0, 0])])
11971204
def test_groupby_categorical_axis_1(code):
11981205
# GH 13420

0 commit comments

Comments
 (0)