pandas multiprocessing apply

后端 未结 8 1404
借酒劲吻你
借酒劲吻你 2020-11-28 06:02

I\'m trying to use multiprocessing with pandas dataframe, that is split the dataframe to 8 parts. apply some function to each part using apply (with each part processed in d

8条回答
  •  情深已故
    2020-11-28 06:15

    Since I don't have much of your data script, this is a guess, but I'd suggest using p.map instead of apply_async with the callback.

    p = mp.Pool(8)
    pool_results = p.map(process, np.array_split(big_df,8))
    p.close()
    p.join()
    results = []
    for result in pool_results:
        results.extend(result)
    

提交回复
热议问题