zl程序教程

您现在的位置是:首页 >  后端

当前栏目

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

List 解决 to The is with 成功 No
2023-09-14 09:04:49 时间

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