类似的未回答问题:逐行处理 Dask 数据帧
我正在处理数百万行长的数据帧,所以现在我试图并行执行所有数据帧操作。我需要转换为 Dask 的一个这样的操作是:
for row in df.itertuples():
ratio = row.ratio
tmpratio = row.tmpratio
tmplabel = row.tmplabel
if tmpratio > ratio:
df.loc[row.Index,'ratio'] = tmpratio
df.loc[row.Index,'label'] = tmplabel
Run Code Online (Sandbox Code Playgroud)
在 Dask 中按索引设置值或有条件地在行中设置值的合适方法是什么?由于.loc
不支持DASK项任务,似乎没有成为set_value
,at[]
或者iat[]
在DASK无论是。
我尝试将map_partitions与assign一起使用,但我没有看到在行级别执行条件分配的任何能力。