Skip to content

Instantly share code, notes, and snippets.

@mindey
Last active October 20, 2017 22:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mindey/c18222d940dafebd8076f005761f53b7 to your computer and use it in GitHub Desktop.
Save mindey/c18222d940dafebd8076f005761f53b7 to your computer and use it in GitHub Desktop.
import pandas
import multiprocessing
def apply_parallel(grouped_df, func):
with multiprocessing.Pool(multiprocessing.cpu_count()) as p:
ret_list = p.map(func, [group for name, group in grouped_df])
return pandas.concat(ret_list)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment