[英]How can I combine the dataframes returned by a function efficiently in python?
[英]Combine dataframes returned from python multiprocess calling function
from multiprocessing import Pool
with Pool(processes=6) as p:
p.starmap(update_tabl, zip(r))
我正在使用這里概述的方法: https : update_table
並行調用函數update_table
返回一個數據幀作為輸出。
如何連接所有這些數據框? 如果我使用 for 循環但不確定如何並行執行,我可以使用pd.concat
您可以對星圖的結果進行連接:
with Pool(processes=6) as p:
res = pd.concat(p.starmap(update_table, zip(rows)))
# do stuff with res
concat 不會並行發生,但是一旦星圖完成。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.