【发布时间】:2019-11-29 13:05:51
【问题描述】:
dask 数据框如下所示:
A B C D
1 foo xx this
1 foo xx belongs
1 foo xx together
4 bar xx blubb
我想按列 A、B、C 分组,并在 D 之间用空格连接字符串以获取
A B C D
1 foo xx this belongs together
4 bar xx blubb
我知道如何用 pandas 做到这一点:
df_grouped = df.groupby(['A','B','C'])['D'].agg(' '.join).reset_index()
如何使用 dask 实现这一点?
【问题讨论】:
标签: python pandas dataframe pandas-groupby dask