I am aware of the practice that label encoding
is preferred for ordinal variables
while one-hot encoding
is done for nominal variables
. But what if we label encode
nominal variables? Will it have any negative impact on modeling or prediction?
For eg -
>>> data['Card_Category'].unique()
... array(['Blue', 'Gold', 'Silver', 'Platinum'], dtype=object)
>>> card_mapping = {'Blue': 0, 'Gold': 1, 'Silver': 2, 'Platinum': 3}
>>> data['Card_Category'].replace(card_mapping, inplace=True)
Instead of using one-hot encoding, I have used label encoding. Thoughts on this?
sklearn
implementation. $\endgroup$