1import pandas as pd
2data = {'col_1': [3, 2, 1, 0], 'col_2': ['a', 'b', 'c', 'd']}
3pd.DataFrame.from_dict(data, orient='index').T
1>>> data = {'col_1': [3, 2, 1, 0], 'col_2': ['a', 'b', 'c', 'd']}
2>>> pd.DataFrame.from_dict(data)
3 col_1 col_2
40 3 a
51 2 b
62 1 c
73 0 d
8
1#Lazy way to convert json dict to df
2
3pd.DataFrame.from_dict(data, orient='index').T
1In [11]: pd.DataFrame(d.items()) # or list(d.items()) in python 3
2Out[11]:
3 0 1
40 2012-07-02 392
51 2012-07-06 392
62 2012-06-29 391
73 2012-06-28 391
8...
9
10In [12]: pd.DataFrame(d.items(), columns=['Date', 'DateValue'])
11Out[12]:
12 Date DateValue
130 2012-07-02 392
141 2012-07-06 392
152 2012-06-29 391
16
1>>> df.to_dict('records')
2[{'col1': 1, 'col2': 0.5}, {'col1': 2, 'col2': 0.75}]
3