Skip to content

Commit 97d8904

Browse files
YagoGGrhshadrach
authored andcommitted
TST: Check index when grouping all columns of empty DF (pandas-dev#32464) (pandas-dev#48067)
TST: Check MultiIndex when grouping by all columns of an empty DF (pandas-dev#32464) Co-authored-by: Richard Shadrach <[email protected]> Co-authored-by: Richard Shadrach <[email protected]>
1 parent 470d4cd commit 97d8904

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)