I have DataFrame which have 3 columns:
order_id user_id Details
5c7c9 A [{"amount": "160",'id':'p2'},{"amount": "260",'id':'p3'}]
5c5c4 B [{"amount": "10",'id':'p1'},{"amount": "260",'id':'p3'}]
I want my final Dataframe to be like:
order_id user_id amount id
5c7c9 A 160 p2
5c7c9 A 260 p3
5c5c4 B 10 p1
5c5c4 B 260 p3
First if necessary convert values to list of dictianaries by
ast.literal_eval
, then use dictionary comprehension withDataFrame
constructor andconcat
and last useDataFrame.join
for add to original:You can use: