In some of the “knn_train_test” functions, when calling the predict method, you used “knn.predict(test_df[[target_col]])”, while the solution notebook has “knn.predict(test_df[[train_col]])”. I think that’s the main difference.
When making this change, you get the same results that I do (I’ve checked), still different from the solution notebook.
Intrigued by this, I downloaded the solution’s notebook and ran it on my PC, and it turns out that I got the same results that I did running my own code. A possible explanation is that the dataset downloaded by us is slightly different than the one used in the solution notebook, but I don’t know for sure, since I didn’t quite looked into it.
Hope it helps!