scikit-learn: ColumnTransformer

Different preprocessing for numeric and categorical columns, in one object

40 min · interactive lesson with runnable code and 4 graded exercises.

What you'll be able to do

  • Build numeric and categorical branches with ColumnTransformer
  • Combine it with a model into one Pipeline and score it
  • Control leftover columns with remainder
  • Read coefficients via get_feature_names_out()

The full lesson is free with an account.

Two branches

The full estimator

Columns you didn't name

Feature names and coefficients

Choosing columns from dtypes

Where leakage still hides