【发布时间】:2018-08-29 10:40:32
【问题描述】:
有以下数据:
board_href_deals items test1
0 test2 {'x': 'a'} test1
1 test2 {'x': 'b'} test2
分组“board_href_deals”后, 我想以列表格式输出现有数据,如下所示:
board_href_deals items test1
0 test2 [{'x': 'a'}, {'x': 'b'}] ['test1', 'test2']
谢谢
【问题讨论】:
-
df.groupby('board_href_deals').agg(list)工作怎么样?
标签: python python-3.x pandas dataframe pandas-groupby