Category_encoders
category_encoders is a Python library providing scikit-learn-compatible transformations that encode categorical variables as numerical features.
Machine Learning for Tabular Data: XGBoost, Deep Learning, and AI
category_encoders is a Python library providing scikit-learn-compatible encoders for categorical variables, including target and ordinal encoders.
- How it is used
- Applies target-based transformations to high-cardinality categorical features before model training.
- How deep it goes
- Explains target statistics, smoothing, and encoder selection, then stops short of full implementation details.
- Examples
- Uses neighborhood values, gridded latitude–longitude coordinates, TargetEncoder, column transformation, and five-fold validation.
- What you can do after
- Apply TargetEncoder in a scikit-learn-compatible preprocessing pipeline and tune or replace its smoothing strategy.
Ensemble Methods for Machine Learning
category_encoders is a Python library that provides encoders for converting categorical variables into numerical representations compatible with scikit-learn workflows.
- How it is used
- Supports categorical preprocessing before training scikit-learn-compatible models, including LightGBM and XGBoost.
- How deep it goes
- Demonstrates pipeline construction, column selection, fitting, transformation, and encoder comparison, but does not detail encoder internals.
- Examples
- Uses the Australian Credit Approval dataset to compare one-hot, greedy target, and leave-one-out target encoding.
- What you can do after
- Apply it via scikit-learn pipelines to encode categorical columns and evaluate downstream ensemble models.
Read how Ensemble Methods for Machine Learning explains category_encoders →
Related concepts
- OneHotEncoderuses · OneHotEncoder is a transformer that represents each category of a categorical feature with a separate binary indicator feature.
- categorical datauses · Categorical data consists of values representing membership in a discrete set of named or ordered categories rather than measured numerical magnitudes.
- categorical encodinguses · Categorical encoding transforms discrete category values into numerical representations, such as separate binary indicators or vectors with one active position per category.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.

