python报错:ValueError: Expected 2D array, got scalar array instead

报错代码

 predict_square_feet = 600
 result = linear_model_main(X, Y, predict_square_feet)

修改后

 predict_square_feet = 600
 predict_square_feet = np.array(predict_square_feet).reshape(1, -1)
 result = linear_model_main(X, Y, predict_square_feet)

意思是需要二维数组,但是只拿到一维数组

你可能感兴趣的:(python)