Search
 
SCRIPT & CODE EXAMPLE
 

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 )
Comment

PREVIOUS NEXT
Code Example
Python :: save seaborn lmplot 
Python :: hex to string python 
Python :: how to append number in tuple 
Python :: convert list of lists to pandas dataframe 
Python :: django validators import 
Python :: python split 
Python :: character to ascii python 
Python :: re.match python 
Python :: python lastmonth 
Python :: python tkinter messagebox 
Python :: python sqrt function 
Python :: concatenation of array in python 
Python :: import login required 
Python :: generate n different colors matplotlib 
Python :: run python script automatically every day 
Python :: username python system 
Python :: python list input print 
Python :: dataframe number of unique rows 
Python :: map to list python 
Python :: pytthon how many fridays´ between two dates 
Python :: beautifulsoup getting data from a website 
Python :: update all pip packages 
Python :: how to count number of records in json 
Python :: python variable scope 
Python :: dictionary in python 
Python :: how to use django-rest-framework-datatables 
Python :: create gui python 
Python :: merge 2 dataframes in python 
Python :: pafy doc 
Python :: python spawn process 
ADD CONTENT
Topic
Content
Source link
Name
5+7 =