Your question is Clean and Transform Disjoint Logs. Start with the requirements and the two tables on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
Using Pandas, how would you clean, merge, and transform a dataset containing disjointed user activity logs?
Translate this data-wrangling task into PostgreSQL using the users and activity_logs tables. Normalize user identifiers and event labels, exclude unusable events, remove duplicate normalized records, and summarize activity by user and date.
user_id, activity_date, total_events, active_minutes, and primary_activity.user_id, then activity_date ascending, with missing dates first.| Column | Type | Description |
|---|---|---|
| user_idPK | INT | Canonical user identifier |
| full_name | VARCHAR(100) | User's full name |
| VARCHAR(255) | Canonical user email address |
| Column | Type | Description |
|---|---|---|
| log_idPK | INT | Activity log identifier |
| user_email | VARCHAR(255) | Raw user email from the activity source |
| event_timestamp | TIMESTAMP | Timestamp when the activity occurred |
| event_type | VARCHAR(50) | Raw activity label |
| duration_minutes | INT | Duration associated with the activity |