Interview practice question
Filling missing dates in a daily series
Data Analyst · Python and Pandas · Intermediate
Your daily sales data skips days with no sales, which breaks your moving averages. How do you fix it in pandas?
What a strong answer covers
Your AI report card counts how many of these ideas you cover.
- Create full date range (pd.date_range).
- reindex on date index, fill_value=0.
- Or resample("D").sum().
- Per-group: groupby + reindex/asfreq.
- Then compute rolling metrics.
Practise this topic
Start without signing up. Sign in free to get an AI report card on your answer.