pandas: apply function to dataframe that can return multiple rows,"df.groupby('class', group_keys=False).apply(f)"