Skip to content
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
12 changes: 12 additions & 0 deletions pandas/tests/groupby/aggregate/test_aggregate.py
Original file line number Diff line number Diff line change
Expand Up @@ -1438,3 +1438,15 @@ def test_agg_of_mode_list(test, constant):
expected = expected.set_index(0)

tm.assert_frame_equal(result, expected)


def test_unique_agg_type():
# GH#22558
df1 = DataFrame({"a": [1, 2, 3], "b": [1, 1, 1]})
df2 = DataFrame({"a": [2, 2, 2], "b": [1, 1, 1]})
aggregation = {"a": "unique", "b": "unique"}

agg1 = df1.agg(aggregation)
agg2 = df2.agg(aggregation)

tm.assert_class_equal(agg1, agg2)
Copy link
Member

Choose a reason for hiding this comment

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

Please define expected as a DataFrame and then use tm.assert_frame_equal. Also, this is not a groupby test, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You're right, this shouldn't be in groupby. I've made the changes and moved it to a more appropriate file.