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