Skip to content

TST: Test aggregate with list values #25581 #47559

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 5 commits into from
Jul 5, 2022
Merged
Changes from 3 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
11 changes: 11 additions & 0 deletions pandas/tests/groupby/aggregate/test_aggregate.py
Original file line number Diff line number Diff line change
Expand Up @@ -1413,3 +1413,14 @@ def test_multi_axis_1_raises(func):
gb = df.groupby("a", axis=1)
with pytest.raises(NotImplementedError, match="axis other than 0 is not supported"):
gb.agg(func)


def test_agg_of_list():
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you add mode in the test name as well

# GH#25581
df1 = DataFrame([[20, "A"], [20, "B"], [30, "C"]])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add the other cases from the issue too?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From the issue there are 3 other test cases than the one I originally added. I can add 2 of them, but the final test case still fails on the master with a different error message than in 1.4.1.

result = df1.groupby(0).agg(Series.mode)

expected = DataFrame({0: [20, 30], 1: [["A", "B"], "C"]})
expected = expected.set_index(0)

tm.assert_frame_equal(result, expected)