Question: can knn be used for categorical variables?
Answer: You can use KNN by converting the categorical values into numbers. But it is not clear that you should. If the categories are binary, then coding them as 0–1 is probably okay. ... You can use KNN by converting the categorical values into numbers.