热线电话:13121318867

登录
2021-05-11 阅读量: 1811
python调用sklearn报错: Reshape your data either using array.reshape(-1, 1)

问:

python调用sklearn报错:

Reshape your data either using array.reshape(-1, 1) if your data has a single feature or array.reshape(1, -1) if it contains a single sample.

image.png

image.png


答:

这是因为sklearn传入的数据要求是二维矩阵,需要把传入的数据用 .reshape(1,-1) 转换成二维后再调用就可以了。




102.8571
0
关注作者
收藏
评论(0)

发表评论

暂无数据
推荐帖子