![](/img/trans.png)
[英]Key Error: None of [Int64Index…] dtype='int64] are in the [columns]
[英]Key Error: None of [Int64Index([…]dtype='int64')] are in the [columns]
所以这是我的 DataFrame:
a b c
0 1971 2154 203020339
1 1972 2648 191489250
2 1973 2690 193377651
3 1974 2676 201291002
4 1975 3276 275380446
我试图用它制作一个非常简单的 plot :
df.plot(x = df['a'], y = df['b'])
但我不断收到一条关键错误消息:
None of [Int64Index([1971, 1972, 1973, 1974, 1975], dtype='int64')] are in the [columns]
我尝试使用将列 [a] 转换为 DateTime,但仍然收到相同的错误消息。
df['a'] = pd.to_datetime(df['a'], format='%Y')
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.