I have a Python dictionary like the following:
{u\'2012-06-08\': 388,
u\'2012-06-09\': 388,
u\'2012-06-10\': 388,
u\'2012-06-11\': 389,
u\'2012-06-12\':
When converting a dictionary into a pandas dataframe where you want the keys to be the columns of said dataframe and the values to be the row values, you can do simply put brackets around the dictionary like this:
>>> dict_ = {'key 1': 'value 1', 'key 2': 'value 2', 'key 3': 'value 3'}
>>> pd.DataFrame([dict_])
key 1 key 2 key 3
0 value 1 value 2 value 3
It's saved me some headaches so I hope it helps someone out there!
EDIT: In the pandas docs one option for the data
parameter in the DataFrame constructor is a list of dictionaries. Here we're passing a list with one dictionary in it.