Densify Sparse Play Console Install Data and Compute Seven-Day Totals
Last updated: November 29, 2026
Quick Overview
Daily install counts per app are stored only on days with installs. Fill in missing days with zero from each app's first day through a report end date, then compute trailing seven-day install totals.
0
0
0 solved
Daily install counts per app are stored only on days with installs. Fill in missing days with zero from each app's first day through a report end date, then compute trailing seven-day install totals.
A Play Console style analytics question that hides a classic trap: rolling windows over sparse rows silently span more than seven days. The Google technical screen interviewer checks densification per group with reindex, the start date choice for each app and partial window handling.
What the Interviewer Expects
- Explain why rolling over sparse rows is wrong
- Reindex each app to a full daily range and fill zeros
- Start each app at its own first day, not a global first day
- Use min_periods so early partial windows are not reported as full
- Aggregate duplicate rows per app and date first
Key Topics to Cover
How to Approach This
- Clarify the schema and expected output format before writing queries.
- Use CTEs (WITH clauses) to break complex queries into readable steps.
- Consider window functions (ROW_NUMBER, RANK, LAG, LEAD) for ranking and sequential analysis.
- Watch for NULLs, duplicates, and edge cases in JOINs and GROUP BY.
- For pandas, prefer vectorized operations over row-by-row iteration.
Possible Follow-up Questions
- How would you do this in SQL with GENERATE_DATE_ARRAY?
- Would you use rolling('7D') on a DatetimeIndex instead? What are the trade-offs?
- How would you compare each app's last seven days to the same period a year ago?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice SQL ProblemsSample Answer
Clarify the Data
installs(app_id, date, installs) with no row on zero-install days, and possibly duplicate rows per day from reprocessing. The report runs through a given end date. An app's history starts on its fir...
Approach
Sum duplicates first. Then, per app, build a daily date_range from the app's first date to the end date and reindex with zeros. Once rows are dense, a row-based rolling(7) is exactly a seven-day...