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?
https://datascience.stackexchange.com/q/77880/55122 , https://stats.stackexchange.com/q/411767/232706 , https://stats.stackexchange.com/q/410939/232706 ,
As for implementations as @IgorF. addresses, it depends. See e.g. https://datascience.stackexchange.com/a/87403/55122
– Ben Reiniger Jan 06 '21 at 21:10sklearnimplementation. – Igor F. Jan 06 '21 at 21:51