0
$\begingroup$

When one-hot-encoding categorial features in python with pandas or sklearn, when should I drop one of the resulting columns? I recall something about having all columns present being a problem for machine learning algorithms because of multi-collinearity.

I did find 2 helpful questions here: Dropping one of the columns when using one-hot encoding Handling categorical variables in various ML algorithms

In my case, I'm one-hot-encoding for a random forest, so the answer to the 2nd post says I don't need to drop a column.

The answer to the first question seems to imply that you never have to drop a column because the software (i.e. python in my case) will handle multi-collinearity issues.

Can someone confirm if that is true and shed light on when you would drop one-hot-encoded columns in python?

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.