Ordinal Categorical Encoding or Label Encoding

Ordinal Categorical Encoding or Label Encoding

No alt text provided for this image
No alt text provided for this image
No alt text provided for this image

Ordinal data is a categorical, statistical data type where the variables have natural, ordered categories and the distances between the categories is not known.

For example:

  • Student's grade in an exam (A, B, C or Fail).
  • Educational level, with the categories: Elementary school, High school, College graduate, PhD ranked from 1 to 4.
  • When the categorical variables are ordinal, the most straightforward best approach is to replace the labels by some ordinal number based on the ranks.

Let us do a practical !

import pandas as pd

import datetime

No alt text provided for this image
No alt text provided for this image
No alt text provided for this image



要查看或添加评论,请登录

Amit Kumar的更多文章

社区洞察

其他会员也浏览了