我无法将 Pandas Dataframe 类型转换为日期时间 [英] I can't convert the Pandas Dataframe type to datetime
本文介绍了我无法将 Pandas Dataframe 类型转换为日期时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我很确定我应该这样做:
I am pretty sure I should do like:
df['date'] = pd.to_datetime(df['date'])
但不断收到错误:KeyError:'date'"数据框如下所示:
But is keep getting the ERROR: "KeyError: 'date'" The data frame looks like this:
date value
0 2004-01-01 0.265
1 2004-01-02 0.440
2 2004-01-05 -0.955
3 2004-01-06 -1.892
推荐答案
我发现了问题.将 .csv 保存为 CSV UTF-8 时会出现问题.
I have found the problem. The problem arises when you save the .csv in CSV UTF-8.
这篇关于我无法将 Pandas Dataframe 类型转换为日期时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文