Skip to content

Commit b3dc515

Browse files
TST: Test aggregate with list values pandas-dev#25581
1 parent 8ce4f29 commit b3dc515

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

pandas/tests/groupby/aggregate/test_aggregate.py

+10
Original file line numberDiff line numberDiff line change
@@ -1413,3 +1413,13 @@ def test_multi_axis_1_raises(func):
14131413
gb = df.groupby("a", axis=1)
14141414
with pytest.raises(NotImplementedError, match="axis other than 0 is not supported"):
14151415
gb.agg(func)
1416+
1417+
def test_agg_of_list():
1418+
# GH#25581
1419+
df1 = pd.DataFrame([[20, 'A'], [20, 'B'], [30, 'C']])
1420+
result = df1.groupby(0).agg(pd.Series.mode)
1421+
1422+
expected = pd.DataFrame({0: [20, 30], 1: [['A', 'B'], 'C']})
1423+
expected = expected.set_index(0)
1424+
1425+
tm.assert_frame_equal(result, expected)

0 commit comments

Comments
 (0)