Funnel Conversion from Event Logs

easy
Unit 6 · Hypothesis Testing I0/3 to milestone

How many users who view a product go on to add it to the cart, and then check out? Build a funnel from raw events.

Events are (user_id, event_name, timestamp) tuples in any order. A user reaches step k if they did step 1, then step 2 at or after that time, and so on, in order. Each step must happen at or after the previous step's earliest qualifying time.

Implement funnel(events, steps) returning a list of dicts, one per step: {"step", "users", "conversion_from_previous", "conversion_from_start"}, with conversions as fractions (the first step has 1.0 for both, or 0.0 if nobody started).

#product-analytics#funnels2 visible + 2 hidden tests
solution.py · Python 3.13
Loading editor…
Run your code to see results. ⌘↵ to run · ⌘⇧↵ to submit
Funnel Conversion from Event Logs · TechGradify