I have 10 pandas data frames that I am looping to apply a function and store results into CSV and .npz file. As these 10 data frames are independent, I am looking to parallelize the for loop using multiprocessing but unable to get output.
i = 1
dfs = [df_1,df_2, df_3, df_4,df_5,df_6,df_7,df_8,df_9,df_10]
for df in dfs:
X = df_to_sparse(df, Q, features)
sparse.save_npz(os.path.join(data_path, f"X-{i}"), X)
X1 = pd.DataFrame(X.todense())
X1.to_csv('Features_'+str(i)+'.csv', index = False)
i = i+1