X2=[28488,10.528555,1.304844]
X2=std_m(X2)
y_predict2 = knn.predict(X2)
print(y_predict2)
问题:
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.
修改:
X2的输入, 再加一个 [ ]
X2=[[28488,10.528555,1.304844]] ####划重点,外面再加一个中括号
X3=std_m(X2)
y_predict2 = knn.predict(X3)
print(y_predict2)
来源:CSDN
作者:weixin_39107270
链接:https://blog.csdn.net/weixin_39107270/article/details/103486491