2
目前我正在使用來自FRED的一些數據,我使用quandl進行了抽取。 我收到的數據是在一個數據幀中。熊貓數據框:將年份和列索引更改爲月份
目前,它返回像這樣
DATE VALUE
1966-01-01 31.880
1966-02-01 32.080
1966-03-01 32.180
1966-04-01 32.280
... ...
2013-08-01 233.323
2013-09-01 233.632
2013-10-01 233.718
2013-11-01 234.121
但我想用於重組爲顯示:
Jan Feb Mar Apr...
1966 31.880 32.080 32.180 32.280
...
2013 233.323 233.632 233.718 234.121
編輯:我想這將是有益的。
DatetimeIndex(['1966-01-01', '1966-02-01', '1966-03-01', '1966-04-01',
'1966-05-01', '1966-06-01', '1966-07-01', '1966-08-01',
'1966-09-01', '1966-10-01',
...
'2015-04-01', '2015-05-01', '2015-06-01', '2015-07-01',
'2015-08-01', '2015-09-01', '2015-10-01', '2015-11-01',
'2015-12-01', '2016-01-01'],
dtype='datetime64[ns]', name=u'DATE', length=601, freq=None)
Index([u'VALUE'], dtype='object')
我不認爲這會工作,由於日在被索引,而不是列。 – user3093175
如果DATE是索引,則可以使用'df.index'而不是'df.DATE.dt',查看更新。 – Psidom
謝謝Psidom。我對熊貓有點新鮮,並且有很多會員記憶的方法。 – user3093175