![](/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.