Feature Engineering
Feature Engineering is the process of using domain knowledge and data manipulation to create new features, or transform existing ones, so that a machine learning model can learn from the data more effectively.
Why It's Needed
Raw data rarely arrives in a form that's ideal for modeling. A model can only learn from the patterns explicitly present in its input columns - feature engineering is how you surface hidden patterns that raw data doesn't show directly.
A Simple Example
import pandas as pd
df = pd.DataFrame({
"OrderDate": pd.to_datetime(["2026-01-05", "2026-06-15", "2026-12-25"])
})
# Engineering new features from a single date column
df["Month"] = df["OrderDate"].dt.month
df["IsWeekend"] = df["OrderDate"].dt.dayofweek >= 5
df["IsFestiveSeason"] = df["Month"].isin([10, 11, 12])
Common Types of Feature Engineering
- Creating new features by combining existing ones (e.g. Income / FamilySize = per-person income)
- Extracting parts of a value (e.g. pulling day, month, or year out of a date)
- Converting categories into numbers a model can use
- Scaling numeric features to comparable ranges
Coming Up Next
Next, you'll walk through the typical process followed while doing feature engineering on a real dataset.