【发布时间】:2018-06-15 09:09:39
【问题描述】:
我有一个索引为 DateTime 标记的数据框。我想通过格式化索引来改变它。我必须使用 strftime 来申请,但是当我以前喜欢这个时它不起作用。
df.index = df.index.map(strftime('%Y-%m-%d'))
Error: 'strftime' is not defined
但是当我这样做时它工作得很好:
df1.index[0].strftime('%Y-%m-%d')
我想申请我所有的索引。请给点建议?
【问题讨论】:
标签: python pandas dataframe timestamp