Skip to content

TST: Check index when grouping all columns of empty DF (#32464) #48067

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 15, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions pandas/tests/groupby/test_function.py
Original file line number Diff line number Diff line change
Expand Up @@ -1574,3 +1574,15 @@ def test_corrwith_with_1_axis():
)
expected = Series([np.nan] * 6, index=index)
tm.assert_series_equal(result, expected)


def test_multiindex_group_all_columns_when_empty(groupby_func):
# GH 32464
df = DataFrame({"a": [], "b": [], "c": []}).set_index(["a", "b", "c"])
gb = df.groupby(["a", "b", "c"])
method = getattr(gb, groupby_func)
args = get_groupby_method_args(groupby_func, df)

result = method(*args).index
expected = df.index
tm.assert_index_equal(result, expected)