The original code is as follows:
result_m2 = pd.DataFrame(columns = colnames,index = main_dict.keys())
for r in range(rand):
for s in [0.5,0.6,0.7,0.8]:
for n in num:
for k,t in main_dict.items():
colname = str(r) + '_' + str(s) + '_' + str(n)
result_m2.at[k, colname] = func(df=df_new,rand_num=r,nb=n,t=t,target='com',ts=s)
How to store result to dataframe from multiple processes with multiple parameter in python such as follows:
with Pool() as pool:
L = pool.starmap(func, [(1, 1), (2, 1), (3, 1)])