technicalmedium
Write a Python function that reads a CSV file with columns user_id, event_type, timestamp, and returns a dictionary mapping each date to the conversion rate for a funnel step where event_type equals "purchase". Assume a conversion occurs when a user has at least one "purchase" event after a "signup" event on the same day.
technical screen · 3-5 minutes
How to structure your answer
Framework + step-by-step strategy (120-150 words, no story)
Sample answer
Complete polished answer (175-200 words)
Key points to mention
- • CSV parsing with dtype and parse_dates
- • Handling duplicate events and missing data
- • Efficient grouping using groupby
- • Conversion logic: signup before purchase on same day
- • Return type and edge case handling
Common mistakes to avoid
- ✗ Not converting timestamp to datetime
- ✗ Ignoring duplicate signup events
- ✗ Using a naive count of purchases without matching signup
- ✗ Returning a list instead of a dictionary