zl程序教程

您现在的位置是:首页 >  其它

当前栏目

完美解决ValueError: cannot reindex from a duplicate axis

解决 Cannot from 完美 Duplicate ValueError axis
2023-09-27 14:27:32 时间

完美解决ValueError: cannot reindex from a duplicate axis

在这里插入图片描述

报错问题

之前在工作中遇到过这个坑,记录一下问题以及解决方法,不一定针对所有情况都能用,但是可以供大家参考。
问题描述如下:

ValueError: cannot reindex from a duplicate axis

值错误:不能从重复的轴重新索引

在这里插入图片描述

解决方法

在这里插入图片描述
features: list,two features to investigate,经过分析,features是需要指定两个不同的特征,即x和y,而且x=y,之所以,出现上述错误,是因为定义的两个特征完全一致,导致不满足该函数方法!所之需要将其中一个特征名改为另一个即可!

features=[num_col2plot,num_col2plot02]

PS

有问题评论区留言即可