dask:如何分组,聚合而不丢失用于分组的列
dask: how to groupby, aggregate without losing column used for groupby
如何在对以下数据进行分组时获得 SQL 样式的分组输出:
item frequency
A 5
A 9
B 2
B 4
C 6
df.groupby(by = ["item"]).sum()
结果:
item frequency
A 14
B 6
C 6
在pandas中是通过设置as_index=False
来实现的。但是 dask 没有 support this argument in groupby。它目前省略了 item
列和 returns 具有 frequency
列的系列。
也许之后打电话给 .reset_index
?
如何在对以下数据进行分组时获得 SQL 样式的分组输出:
item frequency
A 5
A 9
B 2
B 4
C 6
df.groupby(by = ["item"]).sum()
结果:
item frequency
A 14
B 6
C 6
在pandas中是通过设置as_index=False
来实现的。但是 dask 没有 support this argument in groupby。它目前省略了 item
列和 returns 具有 frequency
列的系列。
也许之后打电话给 .reset_index
?