2024-05-18 11:05:24 发布
网友
我想知道是否有人能帮我这个忙。我正在学习多元线性回归,并试图做一些练习,但似乎遇到了一个问题。我试图用onehotencoder将payment_类型转换为一个分类变量。这里有错误和数据的前几行和列。我试着上网看看,做别人建议的事情,但我也不断从中得到错误。有办法解决这个问题吗?我已经试了好几个小时了。我也不知道为什么它说不能转换VTS,而这是我试图转换的付款类型。如有任何想法和帮助,我们将不胜感激。在
在屏幕上看到之前的代码基本上只是加载数据,就这样。在
谢谢!在
sklearn.preprocessing.OneHotEncoder的文档说明:
Encode categorical integer features using a one-hot aka one-of-K scheme.The input to this transformer should be a matrix of integers, denoting the values taken on by categorical (discrete) features.
Encode categorical integer features using a one-hot aka one-of-K scheme.
The input to this transformer should be a matrix of integers, denoting the values taken on by categorical (discrete) features.
您需要使用sklearn.preprocessing.LabelEncoder,将字符串变量转换为类别整数值。在
sklearn.preprocessing.OneHotEncoder的文档说明:
您需要使用sklearn.preprocessing.LabelEncoder,将字符串变量转换为类别整数值。在
相关问题 更多 >
编程相关推荐