Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

pandas parallelize for loop

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 )
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #pandas #parallelize #loop
ADD COMMENT
Topic
Name
4+6 =