sklearn.exceptions.NotFittedError: This KNeighborsRegressor instance is not fitted yet. Call 'fit' with appropriate arguments before using this estimator.
原因是没有对训练集进行拟合。
解决方法:
在
df['Predict_Signal'] = kNN_reg.predict(X)
前面加上下面的语句
# 模型拟合 kNN_reg.fit(X_train, y_train)