Skip to content

Commit 5d018c3

Browse files
YagoGGrhshadrach
andcommitted
TST: Check MultiIndex when grouping by all columns of an empty DF (#32464)
Co-authored-by: Richard Shadrach <[email protected]>
1 parent 03b4095 commit 5d018c3

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
@@ -1574,3 +1574,15 @@ def test_corrwith_with_1_axis():
15741574
)
15751575
expected = Series([np.nan] * 6, index=index)
15761576
tm.assert_series_equal(result, expected)
1577+
1578+
1579+
def test_multiindex_group_all_columns_when_empty(groupby_func):
1580+
# GH 32464
1581+
df = DataFrame({"a": [], "b": [], "c": []}).set_index(["a", "b", "c"])
1582+
gb = df.groupby(["a", "b", "c"])
1583+
method = getattr(gb, groupby_func)
1584+
args = get_groupby_method_args(groupby_func, df)
1585+
1586+
result = method(*args).index
1587+
expected = df.index
1588+
tm.assert_index_equal(result, expected)

0 commit comments

Comments
 (0)