I have a dataframe with integer and categorical variables. Should I label encode all variables (both integer and categorical) or should I encode only the categorical features?
1 Answer
$\begingroup$
$\endgroup$
0
You only need to label encode the categorical features. For e.g. if the first column contains categorical data then you can do something like shown below-
from sklearn.preprocessing import LabelEncoder
labelencoder = LabelEncoder()
x[:, 0] = labelencoder.fit_transform(x[:, 0])