January 2020
Beginner to intermediate
432 pages
11h 24m
English
Aside from using pandas and scikit-learn, we can also use another library called Category Encoders. It belongs to a set of libraries compatible with scikit-learn and provides a selection of encoders using a similar fit-transform approach. That is why it is also possible to use them together with ColumnTransformer and Pipeline.
We show two of the available encoders. The first one will be an alternative implementation of the one-hot encoder.
Import the library:
import category_encoders as ce
Create the encoder object:
one_hot_encoder_ce = ce.OneHotEncoder(use_cat_names=True)
Additionally, we could specify an argument called drop_invariant, to indicate that we want to drop columns with a 0 variance. This could help ...
Read now
Unlock full access