Skip to content

Instantly share code, notes, and snippets.

View tejaslodaya's full-sized avatar

Tejas Lodaya tejaslodaya

  • Purdue University
  • West Lafayette, IN, USA
View GitHub Profile
@tejaslodaya
tejaslodaya / apply_df_by_multiprocessing.py
Created February 3, 2017 09:12
pandas DataFrame apply multiprocessing
import multiprocessing
import pandas as pd
import numpy as np
def _apply_df(args):
df, func, num, kwargs = args
return num, df.apply(func, **kwargs)
def apply_by_multiprocessing(df,func,**kwargs):
workers=kwargs.pop('workers')