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

成功解决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"


解决问题

"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函数的时候,数据集中不存在指定的字段,请重新查看当前的字段是否被删除或者重命名,亦或者根本没有该字段!

(0)

相关推荐