Is using pd.Categorical() function accuarate?

Hi,

I am having a hard time to understand what method I should use for transforming string columns for training a model. We have pd.get_dummies, and also LabelEncoder method from sklearn.preprocessing. Here, by using col.codes, we are giving some sort of a ordinal characteristic to the variables in this column, which is wrong. I think we should use pd.get_dummies or OneHotEncoder for transforming this column.

I appreciate it if you could help me to clarify this issue.

Please also mention screen link if you are talking about particular mission.

1 Like