Home > Net >  A question about categorical features using pandas
A question about categorical features using pandas

Time:11-19

I have a little perplexity about categorical variables in pandas.

My question is, if I have already managed to expand the features that I need in my df in the following way

cat1     cat2      cat3
 0        0          1
 1        0          0
 0        0          1
 ..       ..         ..

where df['cat1'].dtype is int64 (same for others), will they be automatically considered as categorical features by running some machine learning algorithm? Or do I need to perform some transformations on them to be treated specifically as categories?

CodePudding user response:

Integers / one hot encoded variables are the norm for non-ordinal categorical features. You've got exactly what you need as input for most models.

  • Related