January 2018
Beginner to intermediate
316 pages
7h 14m
English
Now, let's take a look at our ordinal columns. There is still useful information here, however, we need to transform the strings into numerical data. At the ordinal level, since there is meaning in the data having a specific order, it does not make sense to use dummy variables. To maintain the order, we will use a label encoder.
By a label encoder, we mean that each label in our ordinal data will have a numerical value associated to it. In our example, this means that the ordinal column values (dislike, somewhat like, and like) will be represented as 0, 1, and 2.
In the simplest form, the code is as follows:
# set up a list with our ordinal data corresponding the list indexordering = ['dislike', 'somewhat like' ...
Read now
Unlock full access