I have a data frame in which I have some categorical variables, some are ordinal and others are nominal.
How can I deal with nominal columns/variables that have too many levels? For example, I have a column native_country which would be a nominal variable.
Is there a way of converting such columns like the one mentioned above the way we do it with ordinal variables? Meaning that, when I am converting for ordinal columns you can have only one column for all levels each one having its unique number. But for nominal variables, different methods generate one column per level.
I am working with python and skit-learn library, so for now I decided to use OrdinalEncoder for ordinal columns, and OneHotEncoder for nominal columns.
The link to the dataset: https://www.kaggle.com/datasets/uciml/adult-census-income