efficiently applying a function to a grouped pandas dataframe in parallel,"df.set_index('key', inplace=True)"