问题解决:Expected 2D array, got 1D array instead,Reshape your data either using array.reshape(-1, 1) i

y = df['OUT_AM'] 

建模时遇到的错误:

ValueError: Expected 2D array, got 1D array instead:
array=[5.600000e+03 3.500000e+03 2.000000e+02 ... 5.072458e+06 1.170000e+04
 3.980000e+04].
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.

解决:

y = df['OUT_AM'] 
y = np.array(y).reshape((len(y), 1))

 

你可能感兴趣的:(sklearn,问题解决,机器学习)