P12Feature EngineeringBeginnerDesign10 min
Feature Engineering From a Date Column
Turn raw order timestamps into calendar features while avoiding assumptions about the target.
#dates#pandas#features
Scenario
An e-commerce team wants to predict daily order volume. The raw table includes an order timestamp but no calendar features.
Problem statement
Create useful features from an order_date column and explain how you would test whether they improve a model.
Your Task
- Convert the column to a real datetime type.
- Extract at least day of week, month, and a weekend flag.
- Explain why feature usefulness should be validated rather than assumed.
Example data
orders = pd.DataFrame({
'order_date': ['2026-01-02', '2026-01-03', '2026-02-14']
})Related Concepts
Datetime featuresTime-aware validationSeasonality
Ready to count this problem?
Mark it complete when you have reasoned through the solution in your own words.