0
votes
df1_fit=pd.DataFrame(scaled_features,columns=df1.columns[:-1])
df1_fit.head()

from sklearn.model_selection import train_test_split

X_train, X_test, y_train, 
y_test=train_test_split(scaled_features,df1['Sales'],test_size=0.30)

from sklearn.neighbors import KNeighborsClassifier

knn=KNeighborsClassifier(n_neighbors=5)
knn.fit(X_train,y_train)

then i run it but it shows me, ValueError: Input contains NaN, infinity or a value too large for dtype('float64')

how i can solve it?

1

1 Answers

0
votes

make sure you have no NaN values:

df1 = df1.dropna()