0

Can I use KNN impure for categorical non-ordinal data? I'm working on UCI Adult dataset and there are missing values in 3 categorical variables. The problem is values are not ordinal so I cannot assign numerical values to the categories. Is there a way around it? Can I use KNN in some way?

Tried the simple code:

impute_knn = KNNImputer(n_neighbors = 2)
impute_knn.fit_transform(X)

and of course it's not working as the data is object type

m13op22
  • 2,168
  • 2
  • 16
  • 35
  • Does this answer your question? [Implementing KNN imputation on categorical variables in an sklearn pipeline](https://stackoverflow.com/questions/64900801/implementing-knn-imputation-on-categorical-variables-in-an-sklearn-pipeline) – m13op22 Mar 09 '23 at 22:49

0 Answers0