Generate Synthetic Clickstream Data with Python Function
Company: Amazon
Role: Data Scientist
Category: Coding & Algorithms
Difficulty: medium
Interview Round: Technical Screen
Overview: This question evaluates a candidate's ability to implement synthetic data generation and probabilistic event simulation in Python using libraries like pandas and numpy, emphasizing timestamp handling, random sampling, and feature engineering for clickstream records.
Constraints
- 0 <= num_users <= 1000
- 0 <= days <= 30
- Each user generates 1..10 events per day
- event_ts is in [BASE - days*86400, BASE)
- Return events sorted by (event_ts, user_id, page)
Hints
- Iterate days then users; compute k events per user per day using the provided modular formulas.
- Append dicts to a list and sort by (event_ts, user_id, page) before returning.
- Return an empty list when num_users <= 0 or days <= 0.