Explain the difference between one-hot encoding and label encoding

Difference between one-hot encoding and label encoding

one hot encoding converts the target variable into 0 and 1 as the machine understands 0 and 1. Ex: If the target variable is yes or no, it will be encoded to 0 and 1 by one-hot encoding.

Label encoding gives a label to the target variable in terms of 0,1, 2, etc. Ex: if the height is short, medium, and tall, it has to be 0,1, 2 respectively.