Try this
compact_df = df.groupby('ID').apply(lambda group: group.to_dict(orient='records'))
CLICK HERE to find out more related problems solutions.
Try this
compact_df = df.groupby('ID').apply(lambda group: group.to_dict(orient='records'))
CLICK HERE to find out more related problems solutions.