Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Label Encoding of the Target Variable | Processing Categorical Data
course content

Course Content

Data Preprocessing

Label Encoding of the Target VariableLabel Encoding of the Target Variable

Let's go straight to the main thing - label encoding implements everything the same as ordinal encoder, but:

  • Methods work with different data dimensions;
  • The order of the categories is not important for label encoding.

How to use this method in Python:

Task

Read the dataset 'salary_and_gender.csv' and encode the output column 'Gender' with label encoding.

Everything was clear?

Section 3. Chapter 4
toggle bottom row
course content

Course Content

Data Preprocessing

Label Encoding of the Target VariableLabel Encoding of the Target Variable

Let's go straight to the main thing - label encoding implements everything the same as ordinal encoder, but:

  • Methods work with different data dimensions;
  • The order of the categories is not important for label encoding.

How to use this method in Python:

Task

Read the dataset 'salary_and_gender.csv' and encode the output column 'Gender' with label encoding.

Everything was clear?

Section 3. Chapter 4
toggle bottom row
some-alt