Convert a list of Python dictionaries to a Pandas dataframe


import pandas as pd

To convert a list of python dictionaries to a Pandas dataframe

my_dict = \
[{'score': 99, 'time': '5:15', 'year': 2010}, 
{'score': 75, 'time': '8:15', 'year': 2017}, 
{'score': 82, 'time': '12:30', 'year': 2030}]
df = pd.DataFrame(my_dict)
df
score time year
0 99 5:15 2010
1 75 8:15 2017
2 82 12:30 2030



Ace your next data science interview

Get better at data science interviews by solving a few questions per week



Find a bug? Submit a suggested change on Github, or message me on Twitter.