How to get python dictionaries into a pandas time series dataframe where key is date object

pandas, python

Solution

use `DataFrame.from_dict`:

import pandas as pd
import datetime
timeseries = {datetime.datetime(2013, 3, 17, 18, 19): {'t2': 400, 't1': 1000},
                 datetime.datetime(2013, 3, 17, 18, 20): {'t2': 300, 't1': 3000}
                }
print pd.DataFrame.from_dict(timeseries, orient="index")

output:

                      t2    t1
2013-03-17 18:19:00  400  1000
2013-03-17 18:20:00  300  3000

Problem

I have a python dictionaries where the key is a dateobject and the value is the timeseires. ``` timeseries = {datetime.datetime(2013, 3, 17, 18, 19): {'t2': 400, 't1': 1000}, datetime.datetime(2013, 3, 17, 18, 20): {'t2': 300, 't1': 3000} } ``` How to I get this time series into a pandas dataframe?

Original source