![](https://img-blog.csdnimg.cn/20201014180756930.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
sklearn小坑
CON_FREECSS
热爱世界热爱你
展开
-
ValueError: multiclass-multioutput is not supported
我在做随机森林模型时提示ValueError: multiclass-multioutput is not supported。。问题就是label标签有两行。解决办法:删除一行。原代码:feature = pd.read_excel("train_Lg.xlsx")target = pd.read_excel("train_Lgc.xlsx")更错后代码:feature = pd.read_excel("train_Lg.xlsx")tar..原创 2021-11-13 17:31:21 · 1850 阅读 · 0 评论 -
Pandas库拼接。pd.concat拼接有问题请试试pd.merge
总是容易出现索引不同,拼接异常的情况。试试pd的merge方法df = pd.merge(feature, target, on='ID', how='left')表示将feature和target以ID为索引,用左外连接的方式拼接。结果就没问题啦!...原创 2021-11-13 15:08:07 · 2107 阅读 · 0 评论 -
TypeError: cannot concatenate object of type ‘<class ‘numpy.ndarray‘>‘; only Series and DataFrame ob
TypeError: cannot concatenate object of type '<class 'numpy.ndarray'>'; only Series and DataFrame objs are validdata = pd.concat([data, results], axis=1)问题就在于这个results是numpy数组型,而concat只有dataframe和series能够使用。解决办法:results = DataFra..原创 2021-11-12 23:43:10 · 25570 阅读 · 0 评论 -
使用concat拼接异常
具体错误如下:问题出在,索引不是同一列。data = pd.read_excel("train_Lg.xlsx", index_col=0)target = pd.read_excel("train_Lgc.xlsx",index_col=0)model_data = pd.concat([Y_train, X_train], axis=1)更改后:data = pd.read_excel("train_Lg.xlsx")target = pd.read_exce..原创 2021-11-12 23:16:05 · 1048 阅读 · 0 评论 -
关于AttributerError:‘numpy.ndarray‘ object has no attribute‘value_counts‘
是因为该数据为数组,没有value_counts该方法。在数组变量前面加上series就可以使用value_counts原创 2021-11-12 22:54:15 · 1981 阅读 · 0 评论 -
AttributeError: ‘NoneType‘ object has no attribute ‘info‘
出现:AttributeError: 'NoneType' object has no attribute 'info'问题出在哪里?data = pd.read_excel("train_Lg.xlsx", index_col=0)print("数据类型head就是前五项的意思:", data.head())print("数据结构shape就是形状的意思:", data.shape) # (1000, 312)print("数据的", data.info()) # bool(2.原创 2021-11-12 22:17:26 · 3586 阅读 · 0 评论 -
TypeError: ‘tuple‘ object is not callable
如图:错误点:data.shape()后面的shape不能加(),加了就当函数使用,但是又没有这个函数。原创 2021-11-12 22:07:30 · 795 阅读 · 0 评论 -
sklearn\utils\validation.py:578: DataConversionWarning: A column-vector y was passed when a 1d array
sklearn\utils\validation.py:578: DataConversionWarning: A column-vector y was passed when a 1d array was expected. Please change the shape of y to (n_samples, ), for example using ravel(). y = column_or_1d(y, warn=True)注意:这是一个问题,警告,不影响最后结果的输出。最后依然会..原创 2021-11-11 19:06:57 · 443 阅读 · 0 评论