Label encoder vs One Hot Encoder

 

One-Hot Encoding vs. Label Encoding using Scikit-Learn

when to use label encoder?

If your column has two variables for example yes and no at this situation this method works perfectly well 

code:

here dataset is our excel or csv file 

What is label encoder how it differ from one-hot encoder?

Image result for draw back of label encoder
here purchased column can be encoded by label encode .but problem arises in country column where it has more that two unique variables

What one hot encoding does is, it takes a column which has categorical data, which has been label encoded, and then splits the column into multiple columns. The numbers are replaced by 1s and 0s, depending on which column has what value. ... So, that's the difference between Label Encoding and One Hot Encoding.

code:




Comments