'How to add different columns from same dictionary values in Pandas [duplicate]

import pandas as pd  
  
data = {'Name': ['Tom', 'John'], 'Age': [20, 21], 'Marks':[[{'English':90,'Hindi':80},{'English':10,'Hindi':100}],[{'English':100,"Hindi":100},{'English':101,'Hindi':108}]]}  
  
df = pd.DataFrame(data)  

I want a dataframe with output as:

Name Age Marks_English1 Marks_English2 Marks_Hindi1 Marks_Hindi2
Tom 20 90 90 80 100
John 21 100 100 100 108

How can I get the desired output.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source