I am working on a ML problem to predict house prices and Zip Code is one feature which will be useful. I am also trying to use Random Forest Regressor to predict the log of the price.

However, should I use One Hot Encoding or Label Encoder for Zip Code? Because I have about 2000 Zip Codes in my dataset and performing One Hot Encoding will expand the columns significantly.

When to use One Hot Encoding vs LabelEncoder vs DictVectorizor?

  • $\begingroup$ @AN6U5 's answer on the link you attach, provides an answer on your exact issue. Why don't you try that and if the solution does not help then provide further details. This is a duplicate. Also the difference is clearly depicted on the docs and you seem to realize it. $\endgroup$
    – Nikos H.
    Jul 29 '19 at 9:44
  • $\begingroup$ And for the more specific question here, probably a search for questions containing "zip code" could be helpful. $\endgroup$ Jul 29 '19 at 22:45