Back to problems

Transform event logs with subscription windows in pandas

Algorithm · Amazon · Hard

Using pandas, compute user-level, subscription-aligned revenue and anomalies for September 2025. Input DataFrames events(user_id: int, ts: UTC datetime, event: str, product_id: int, price_usd: float), where event is one of 'view', 'add_to_cart', 'purchase'. subs(user_id: int, plan: str, start_ts: UTC datetime, end_ts: UTC datetime or NaT). Requirements For each user, compute active_subscription_days in 2025-09 and the total purchase revenue that occurred while the user was…

Checking your access…