Label Encoding is the process of converting the labels into a number format so as to make them available to the machine in a machine-readable form. Machine learning algorithms can then decide in a better way how those labels must be operated.
Here, we will use sklearn library, which is used for applying machine learning process, usually the algorithms used for training the model and testing the model falls under sklearn library.
We will now understand with the help of an example that how we can do label encoding across multiple columns in sklearn.
For this purpose, we will import preprocessing function from sklearn library which will use Labelencoder method in order to achieve label encoding.
Let us understand with help of an example,
Output:

need an explanation for this answer? contact us directly to get an explanation for this answer