Skip to content

Commit c70f9b9

Browse files
YagoGGrhshadrach
andauthored
TST: Check index when grouping all columns of empty DF (#32464) (#48067)
TST: Check MultiIndex when grouping by all columns of an empty DF (#32464) Co-authored-by: Richard Shadrach <[email protected]> Co-authored-by: Richard Shadrach <[email protected]>
1 parent 06dd5da commit c70f9b9

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

pandas/tests/groupby/test_function.py

+12
Original file line numberDiff line numberDiff line change
@@ -1588,3 +1588,15 @@ def test_corrwith_with_1_axis():
15881588
)
15891589
expected = Series([np.nan] * 6, index=index)
15901590
tm.assert_series_equal(result, expected)
1591+
1592+
1593+
def test_multiindex_group_all_columns_when_empty(groupby_func):
1594+
# GH 32464
1595+
df = DataFrame({"a": [], "b": [], "c": []}).set_index(["a", "b", "c"])
1596+
gb = df.groupby(["a", "b", "c"])
1597+
method = getattr(gb, groupby_func)
1598+
args = get_groupby_method_args(groupby_func, df)
1599+
1600+
result = method(*args).index
1601+
expected = df.index
1602+
tm.assert_index_equal(result, expected)

0 commit comments

Comments
 (0)