Pandas interview question: cart-to-order conversion

MediumFunnels and conversion

Problem

Shared data rules

Find cart-to-order conversion by day and platform for Sep 14–27, 2026. A user with add_to_cart counts as converted if they also have order_placed on the same day and platform.

Formulas

Example

Input: events
event_iduser_idevent_tsevent_nameplatformRow note
112026-09-20 11:00add_to_cartweb
212026-09-20 11:00add_to_cartweb← duplicate of event 1
312026-09-20 11:12order_placedweb
422026-09-20 15:40add_to_cartweb
522026-09-20 16:05add_to_cartweb
622026-09-21 10:10order_placedweb← next day — doesn’t count
732026-09-20 18:30order_placedios← order with no cart — doesn’t count
Output
dayplatformcart_eventscart_usersorder_usersconversion
2026-09-20web3210.5

Sep 20: 3 add-to-carts by 2 users; only user 1 also ordered that day: 1 / 2 = 0.5.

Solve it free

Your code runs on real pandas in your browser. No sign-up needed.

Skills it tests

More interview questions

All questions