Dataframe to nested JSON (grouped by row entry)
I have a python pandas dataframe, which should be converted to a nested JSON (based on the entry found in the column 'laterality'). My dataframe looks like this: import pandas as pd df1 = pd.DataFrame({'id': [1, 1, 1, 2], 'laterality':…