Join Our 5-Week ML/AI Engineer Interview Bootcamp 🚀 led by ML Tech Leads at FAANGs
What is the average number of days between consecutive Apple user sign-ups, ordering all sign-ups by joined_dt in ascending order? Return a single value named avg_days_between_signups, rounded to 2 decimal places.
| Column Name | Type |
|---|---|
| user_id | int64 |
| first_name | object |
| last_name | object |
| object | |
| country | object |
| joined_dt | object |
| Column Name | Type |
|---|---|
| avg_days_between_signups | float64 |
Return single value column avg_days_between_signups.
Order by joined_dt ascending before diff.
Round result to 2 decimal places.
Sort the sign-ups by joined_dt ascending before comparing consecutive rows.
Use a windowed difference (e.g., LAG) to compute the gap from each row to the previous signup date.
Convert the time delta to days, ignore the first NULL gap, then take the mean and round to 2 decimals as avg_days_between_signups.