Write SQL and Python, run instantly in your browser, and track your progress.
You are a Data Engineer at Netflix. The Analytics team needs session quality metrics that combine simple arithmetic with complex scoring logic. Demonstrate when to use vectorized operations for simple calculations and apply() for complex multi-factor scoring.
| Column Name | Type |
|---|---|
| session_id | int64 |
| user_id | int64 |
| device_id | int64 |
| title_id | object |
You are a Data Engineer at Netflix. The Analytics team needs session quality metrics that combine simple arithmetic with complex scoring logic. Demonstrate when to use vectorized operations for simple calculations and apply() for complex multi-factor scoring.
| Column Name | Type |
|---|---|
| session_id | int64 |
| user_id | int64 |
| device_id | int64 |
| title_id | object |
| episode_id | object |
| episode_id | object |
| started_at | object |
| started_at | object |
| ended_at | object |
| ended_at | object |
| watch_seconds | int64 |
| watch_seconds | int64 |
| quality | object |
| quality | object |
| status | object |
| status | object |
| session_id | user_id | device_id | title_id | episode_id | started_at | ended_at | watch_seconds | quality | status |
|---|---|---|---|---|---|---|---|---|---|
| 1 | 1 | 2 | 205 |
| session_id | user_id | device_id | title_id | episode_id | started_at | ended_at | watch_seconds | quality | status |
|---|---|---|---|---|---|---|---|---|---|
| 1 | 1 | 2 | 205 |
| session_id | watch_seconds | watch_minutes | quality | status | quality_score | experience_rating |
|---|---|---|---|---|---|---|
| 1 | 2700 | 45 | hd | completed | 2.75 | Good |
| 2 | 678 | 11.30 | 4k | abandoned | 2.19 |
| session_id | watch_seconds | watch_minutes | quality | status | quality_score | experience_rating |
|---|---|---|---|---|---|---|
| 1 | 2700 | 45 | hd | completed | 2.75 | Good |
| 2 | 678 | 11.30 | 4k | abandoned | 2.19 |
Showing first 5 of 497 rows.
Showing first 5 of 497 rows.
1. Data Selection:
2. Transformation:
3. Output:
1. Data Selection:
2. Transformation:
3. Output:
| 2025-06-26T05:44:01 |
| 2025-06-26T05:44:01 |
| 2025-06-26T06:33:55 |
| 2025-06-26T06:33:55 |
| 2700 |
| 2700 |
| hd |
| hd |
| completed |
| completed |
| 2 | 1 | 1 | 139 | 2025-04-04T23:41:32 | 2025-04-04T23:57:22 | 678 | 4k | abandoned |
| 2 | 1 | 1 | 139 | 2025-04-04T23:41:32 | 2025-04-04T23:57:22 | 678 | 4k | abandoned |
| 3 | 1 | 2 | 328 | 2024-12-04T15:21:55 | 2024-12-04T16:07:01 | 2460 | 4k | completed |
| 3 | 1 | 2 | 328 | 2024-12-04T15:21:55 | 2024-12-04T16:07:01 | 2460 | 4k | completed |
| 4 | 1 | 1 | 38 | 2025-02-15T10:35:42 | 2025-02-15T11:40:58 | 3626 | uhd | abandoned |
| 4 | 1 | 1 | 38 | 2025-02-15T10:35:42 | 2025-02-15T11:40:58 | 3626 | uhd | abandoned |
| 5 | 1 | 1 | 5 | 2025-06-15T03:24:01 | 2025-06-15T03:33:03 | 293 | sd | error |
| 5 | 1 | 1 | 5 | 2025-06-15T03:24:01 | 2025-06-15T03:33:03 | 293 | sd | error |
| Fair |
| Fair |
| 3 | 2460 | 41 | 4k | completed | 4.68 | Excellent |
| 3 | 2460 | 41 | 4k | completed | 4.68 | Excellent |
| 4 | 3626 | 60.40 | uhd | abandoned | 2.50 | Good |
| 4 | 3626 | 60.40 | uhd | abandoned | 2.50 | Good |
| 5 | 293 | 4.90 | sd | error | 0.28 | Poor |
| 5 | 293 | 4.90 | sd | error | 0.28 | Poor |