Interview practice question
Seven-day rolling average per store
Data Analyst · Python and Pandas · Intermediate
How do you compute a seven-day rolling average of sales for each store in pandas?
What a strong answer covers
Your AI report card counts how many of these ideas you cover.
- Sort by store and date.
- Ensure continuous dates per store.
- groupby("store")["sales"].transform(lambda s: s.rolling(7).mean()).
- Or time-based rolling("7D") with date index.
- min_periods setting.
Practise this topic
Start without signing up. Sign in free to get an AI report card on your answer.