I am trying to train a simple model with sklearn kneighborsclassifier on wine quality data. This is my code:
from sklearn.neighbors import KNeighborsClassifier
import pandas as pd
import numpy as np
dataframe = pd.read_csv("winequality-white.csv")
dataframe = dataframe.drop(["fixed acidity", "pH", "sulphates"], axis=1)
test = dataframe[110:128]
train = dataframe[15:40]
Y = train["quality"]
X = train.drop(["quality"], axis=1)
#print(X)
#print(Y)
knn = KNeighborsClassifier()
knn.fit(X, Y)
testvals = np.array(test.loc[110, :])
testvals = testvals.reshape(1, -1)
print(knn.predict([[testvals]]))
I get the error "ValueError: Found array with dim 4. Estimator expected <= 2."
I'm fairly certain it has something to do with the shape of my array and I have tried to reshape it, but had no luck. What should I do?