📜  pandas 并行化 for 循环 - Python 代码示例

📅  最后修改于: 2022-03-11 14:46:31.207000             🧑  作者: Mango

代码示例1
import multiprocessing as mp
pool = mp.Pool(processes=mp.cpu_count())

def func( arg ):
    idx,row = arg
    # Edit df
    return row

new_rows = pool.map( func, [(idx,row) for idx,row in data_all.iterrows()])
data_all_new = pd.concat( new_rows )