Reputation: 78244
I am using the below to create a dataframe using Pandas on Python 2.7. How to I get utcdt to be the time series index?
data_hash = {u'impressions': 105.0, u'campaign_id': u'cid2504649263', 'utcdt': datetime.datetime(2013, 10, 29, 18, 0)}
df = pd.DataFrame.from_dict(data_hash, orient="index")
Upvotes: 1
Views: 1476
Reputation: 32095
You should transpose the dataframe first before setting the index:
df.T.set_index('utcdt')
Out[133]:
impressions campaign_id
utcdt
2013-10-29 18:00:00 105 cid2504649263
Upvotes: 1