ValueError:操作数无法与形状(74,58)(66,)(74,58)一起广播

2022-01-19 00:00:24 发布

您现在位置:Python中文网/ 问答频道 /正文

编写此代码后:

from sklearn.preprocessing import MinMaxScaler

scaler = MinMaxScaler()

X_train = scaler.fit_transform(X_train)

X_test = scaler.transform(X_test)

错误是

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-99-55872220c4e4> in <module>()
      5 X_train = scaler.fit_transform(X_train)
      6 
----> 7 X_test = scaler.transform(X_test)

/usr/local/lib/python3.6/dist-packages/sklearn/preprocessing/data.py in transform(self, X)
    387                         force_all_finite="allow-nan")
    388 
--> 389         X *= self.scale_
    390         X += self.min_
    391         return X

ValueError: operands could not be broadcast together with shapes (74,58) (66,) (74,58) 

救命啊,求你了