python - Flatten nested pandas dataframe -
i'm wondering how flatten nested pandas dataframe demonstrated in picture attached.
the nested attribute given 'data' field. in short: have list of participants (denoted 'participant_id') , submitted responses ('data') @ different times. need create wide dataframe, each participant @ each time stamp there row of records of data ('q1', 'q2',...,'summary')
many in advance!
try this:
pd.concat([df.data.apply(pd.series), df.drop('data', axis=1)], axis=1)
Comments
Post a Comment