How to read list of dict to Pandas DataFrame

Suppose you have a list of dicts, and you want to get them into a dataframe. Here's an example how:

from pandas import DataFrame
data = [{'a': 1, 'b': 2, 'c': '3'},
        {'a':2, 'b':1},
        {'c':1}]
df = DataFrame.from_records(data)
df.head()

Here's what you get:

    a   b    c
0   1   2    3
1   2   1  NaN
2 NaN NaN    1
 
[3 rows x 3 columns]