Take a photo of a nested pandas dataframe

I am wondering how to smooth out the pandas nested framework as shown in the attached picture. enter image description here

The nested attribute is specified by the "data" field. In short: I have a list of participants (indicated by "member_id"), and they sent responses ("data") at different times. I need to create a wide data frame, where for each participant at each timestamp there is a row of records of their data ("q1", "q2", ..., "summary")

Thank you very much in advance!

+4
source share
1 answer

Try the following:

pd.concat([df.data.apply(pd.Series), df.drop('data', axis=1)], axis=1)
+5
source

Source: https://habr.com/ru/post/1649063/


All Articles