Relative Content

Tag Archive for python-multiprocessing

Why i cannot convert the file from excel to csv in multiprocessing

import multiprocessing def xl2csv(file): temp=pd.read_excel(file) print(“merging”) return temp.to_csv(file[:-5]+’.csv’,index=False) p1=multiprocessing.Process(target=xl2csv,args=(r”…1.xlsx”,)) p2=multiprocessing.Process(target=xl2csv,args=(r”…2.xlsx”,)) p3=multiprocessing.Process(target=xl2csv,args=(r”…3.xlsx”,)) p4=multiprocessing.Process(target=xl2csv,args=(r”…4.xlsx”,)) p1.start() p2.start() p3.start() p4.start() p1.join() p2.join() p3.join() p4.join() I tried the above code and I expect the 4 excel files will be converted to csv, is that i missed some of the parameters. I can perform the above task in a for loop […]

Multiprocessing within multiprocessing

I have a for loop that calls a multiprocessing function (the for loop triggers the function with various inputs). Wondering if there’s a way to have multiprocessing embedded within multiprocessing? If that even makes sense?