Create a Pandas DataFrame from List of Dicts

To convert your list of dicts to a pandas dataframe use the following methods:
  1. pd.DataFrame(data)
  2. pd.DataFrame.from_dict(data)
  3. pd.DataFrame.from_records(data)
Depending on the structure and format of your data, there are situations where either all three methods work, or some work better than others, or some don't work at all.

Create List of Dictionaries

data = [ {'Name': 'John', 'TotalMarks': 82, 'Grade': 'A', 'Promoted': True}, {'Name': 'Doe', 'TotalMarks': 38, 'Grade':'E', 'Promoted': False}, {'Name':'Bill', 'TotalMarks': 63, 'Grade': 'B', 'Promoted': True}]

List of dictionaries to a pandas DataFrame

df = pd.DataFrame(data) df
Name TotalMarks Grade Promoted 0 John 82 A True 1 Doe 38 E False 2 Bill 63 B True

from_dict() method

df = pd.DataFrame.from_dict(data) df
Name TotalMarks Grade Promoted 0 John 82 A True 1 Doe 38 E False 2 Bill 63 B True

Dictionary Orientations

There are two primary types of dictionary orientations : "columns" , and "index" . So, it is important to make the distinction between the different types of dictionary orientations. Dictionaries with the orient='columns' will have their keys correspond to columns in the equivalent DataFrame.
df = pd.DataFrame.from_dict(data, orient='columns') df
Name TotalMarks Grade Promoted 0 John 82 A True 1 Doe 38 E False 2 Bill 63 B True

from_records() method

df = pd.DataFrame.from_records(data) df
Name TotalMarks Grade Promoted 0 John 82 A True 1 Doe 38 E False 2 Bill 63 B True

Setting Custom Index

If you want to set custom index you can use index parameter .
df = pd.DataFrame.from_records(data,index=['1', '2', '3']) df
Name TotalMarks Grade Promoted 1 John 82 A True 2 Doe 38 E False 3 Bill 63 B True