Skip to main content

Feature Engineering Calculator

Generate a complete sklearn ColumnTransformer + Pipeline for your features. Configure scalers, encoders, and vectorizers for numeric, categorical, text, and datetime columns — get production-ready code instantly.

✓ 4 feature types ✓ ColumnTransformer code ✓ Full Pipeline output ✓ Copy-ready Python

Frequently Asked Questions

What is a ColumnTransformer and why use it?▼

ColumnTransformer applies different preprocessing steps to different columns in a single, sklearn-compatible object. For example: StandardScaler on numeric columns, OneHotEncoder on categorical columns, and TfidfVectorizer on text columns — all in one pipeline step. This is the canonical sklearn approach because it prevents data leakage (fit only on training data, transform both train and test), integrates with cross-validation and GridSearchCV, and makes the full pipeline serializable with joblib.dump().

When should I use StandardScaler vs MinMaxScaler vs RobustScaler?▼

StandardScaler (z-score normalization) works best for algorithms that assume Gaussian distributions like linear regression, logistic regression, and SVM. It's sensitive to outliers. MinMaxScaler scales to [0, 1] — good for neural networks and when you need bounded values, but extremely sensitive to outliers. RobustScaler uses median and IQR instead of mean/std — the best choice when your data has significant outliers (income, price, usage data). Tree-based models (Random Forest, XGBoost) don't require scaling at all.

What encoding should I use for categorical features?▼

OneHotEncoder creates a binary column per category — best for nominal categories (country, color) and linear models, but creates high-dimensional output for high-cardinality columns. OrdinalEncoder assigns integers 0,1,2... — works for ordered categories (education level, size: S/M/L/XL) and tree-based models. TargetEncoder replaces categories with the mean target value — powerful for high-cardinality features but requires careful cross-validation to avoid leakage. For very high cardinality (>100 categories), consider embedding or frequency encoding.

How do I handle datetime features in sklearn pipelines?▼

Datetime columns must be decomposed into numeric features before sklearn can use them. Extract components like year, month, day, dayofweek (0=Monday), hour, and quarter using .dt accessor. Cyclical features (month, hour, dayofweek) are better represented as sin/cos pairs to capture their circular nature: sin(2π × month/12), cos(2π × month/12). The FunctionTransformer in sklearn allows wrapping any pandas datetime extraction into a pipeline step. Always parse dates before splitting train/test to avoid type errors.

Share this tool: X / Twitter LinkedIn
✓ 60,000+ developers use DevPlaybook ★★★★★ 4.8 / 5 on Gumroad ✓ MIT licensed · Instant download ✓ No login required

Related Products

on Gumroad

You Might Also Need

More Free Tools

Enjoying this tool? Get more like it.

Weekly developer tool guides, productivity playbooks & AI tricks. Free. No spam.

DevPlaybook Pro 7 days free

Unlock AI-Powered Dev Tools

  • ⚡ AI Code Review, Doc Generator & SQL Builder
  • ⚡ All premium templates & early access
  • ⚡ Member discounts on Gumroad products
Start Free Trial →

$9/mo after trial · Cancel anytime

Want the full toolkit?

Get DevPlaybook Pro

Every template, guide, boilerplate, and automation script in one bundle. 13 premium products — grab them all at once and save big.

$79
$241 separately Save $162 (67% off)
Get DevPlaybook Pro — $79 →

MIT licensed · Instant download · No subscription

See what's included → Browse all deals →