Examples
The keys of the dict become the DataFrame columns by default:
import numpy as np
import pandas as pd
data = {'c_1': [4, 3, 2, 0], 'c_2': ['p', 'q', 'r', 's']}
pd.DataFrame.from_dict(data)
Specify orient='index' to create the DataFrame using dictionary keys as rows:
data = {'row_1': [4, 3, 2, 0], 'row_2': ['p', 'q', 'r', 's']}
pd.DataFrame.from_dict(data, orient='index')
When using the ‘index’ orientation, the column names can be specified manually:
pd.DataFrame.from_dict(data, orient='index',
columns=['P', 'Q', 'R', 'S'])