已解决ValueError: Found input variables with inconsistent numbers of samples: [86, 891]
![在这里插入图片描述 已解决ValueError: Found input variables with inconsistent numbers of samples: [86, 891]_开发语言](https://file.cfanz.cn/uploads/jpeg/2023/09/22/10/aUSd911b79.jpeg)
文章目录
- 报错问题
- 解决方法
- 声明
报错问题
之前在工作中遇到过这个坑,记录一下问题以及解决方法,不一定针对所有情况都能用,但是可以供大家参考。
问题描述如下:
ValueError: Found input variables with inconsistent numbers of samples: [86, 891]
值错误:发现输入参数变量与样本数不一致:[86,891]。我们可以输出参数变量的形状查看,发现的确不一致,找到了问题的根源!
print(X.shape)
print(y.shape)
(86, 4)
(891,)![在这里插入图片描述 已解决ValueError: Found input variables with inconsistent numbers of samples: [86, 891]_解决方法_02](https://file.cfanz.cn/uploads/jpeg/2023/09/22/10/7KDH1O053d.jpeg)
解决方法
![在这里插入图片描述 已解决ValueError: Found input variables with inconsistent numbers of samples: [86, 891]_开发语言_03](https://file.cfanz.cn/uploads/png/2023/09/22/10/7H8Ade9HaP.png)
对问题进行改进,使结果长度保持一致即可,输出结果查看
print(X.shape)
print(y.shape)
(891, 14)
(891,)声明
解决方法参考网络,如有侵权联系我删除









