Katkat

Generate Weekly Revenue and Engagement Summary with Pandas

DoorDashData Scientist · Technical Screen

Last updated

This question evaluates proficiency in data manipulation and analytics with Pandas and SQL, covering aggregations, distinct purchase counts, lambda-based user-tier classification, and platform-level conversion-rate computation.

events

user_idevent_timeevent_typeplatformrevenue
1012024-04-01 12:01:00clickiOS0.00
1012024-04-01 12:02:10purchaseiOS4.99
2022024-04-01 13:05:33viewAndroid0.00
3032024-04-01 14:20:05clickWeb0.00
2022024-04-01 14:45:00purchaseAndroid9.99
Scenario

You own the clickstream pipeline for a consumer app and must create a weekly revenue and engagement summary.

Question

Using Pandas, create a DataFrame that aggregates total revenue and distinct purchase counts per user from the events table. Use a lambda function inside apply to classify users into tiers based on total revenue (e.g., 0, 0–5, 5+). Write a SQL query that returns, for each platform, the daily conversion rate (purchases / clicks) for the last 30 days.

Hints

Show familiarity with groupby, apply-lambda, dictionary mapping, and SQL aggregations with conditional filtering.