def func(df): return df.shape cores = mp.cpu_count() df_split = np.array_split( df, cores, axis=0) # split an array into sub-arrays (array, num of sub arrary) # creative the multiprocessing pool pool = Pool(cores) # process the DataFrame by mapping unction to each df2 across the pool df_out = np.vstack(pool.map( func, df_split)) # stack arrays in sequence verticlally (row1 row2...) print("dataframe iteration:", df_out) # close down the pool and join pool.close() pool.join() pool.clear() # [25, 16, 9, 4, 1] #