天天看點

成功解決KeyError: “Passing list-likes to .loc or [] with any missing labels is no longer supported. The

解決問題

 "Passing list-likes to .loc or [] with any missing labels "

KeyError: "Passing list-likes to .loc or [] with any missing labels is no longer supported. The following labels were missing: Index(['Item_Identifier'], dtype='object'). See

https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#deprecate-loc-reindex-listlike"

解決思路

“将清單like傳遞給.loc或[],且沒有任何标簽”

KeyError: "不再支援将清單類型傳遞給.loc或[],且不支援任何缺失的标簽。以下标簽缺失:Index(['Item_Identifier'], dtype='object')。

https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html

# deprecate-loc-reindex-listlike”

解決方法

在執行loc函數的時候,資料集中不存在指定的字段,請重新檢視目前的字段是否被删除或者重命名,亦或者根本沒有該字段!

繼續閱讀