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