Skip to content

Commit 5501f05

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 5501f05

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

pandas/tests/groupby/test_function.py

+8
Original file line numberDiff line numberDiff line change
@@ -1574,3 +1574,11 @@ 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():
1580+
# GH 32464
1581+
df = DataFrame({"a": [1], "b": [2], "c": [3]}).set_index(['a', 'b', 'c'])
1582+
result = df.groupby(["a", "b", "c"]).sum().index[:0]
1583+
expected = df.index[:0]
1584+
tm.assert_index_equal(result, expected)

0 commit comments

Comments
 (0)