Write SQL and Python, run instantly in your browser, and track your progress.
You are a Growth Analyst at Meta. The Trust & Safety team needs a geographic breakdown of user account statuses to identify regions with higher rates of suspended accounts. Create a pivot table showing the count of users by country and account status.
| Column Name | Type |
|---|---|
| user_id | int64 |
| username | object |
| country | object |
| account_status | object |
You are a Growth Analyst at Meta. The Trust & Safety team needs a geographic breakdown of user account statuses to identify regions with higher rates of suspended accounts. Create a pivot table showing the count of users by country and account status.
| Column Name | Type |
|---|---|
| user_id | int64 |
| username | object |
| country | object |
| account_status | object |
| is_verified | int64 |
| is_verified | int64 |
| user_id | username | country | account_status | is_verified |
|---|---|---|---|---|
| 1 | alice_dev | US | active | 1 |
| 2 | bob_writer | UK | active | 0 |
| user_id | username | country | account_status | is_verified |
|---|---|---|---|---|
| 1 | alice_dev | US | active | 1 |
| 2 | bob_writer | UK | active | 0 |
| country | active | deleted | suspended |
|---|---|---|---|
| AU | 6 | 0 | 1 |
| BR | 3 | 0 | 0 |
| CA | 4 | 0 | 1 |
| DE | 3 | 0 | 1 |
| country | active | deleted | suspended |
|---|---|---|---|
| AU | 6 | 0 | 1 |
| BR | 3 | 0 | 0 |
| CA | 4 | 0 | 1 |
| DE | 3 | 0 | 1 |
Showing first 5 of 16 rows.
Showing first 5 of 16 rows.
1. Data Selection:
2. Reshaping:
3. Output:
1. Data Selection:
2. Reshaping:
3. Output:
| 3 |
| 3 |
| carol_photo |
| carol_photo |
| US |
| US |
| suspended |
| suspended |
| 0 |
| 0 |
| 4 | david_music | CA | active | 1 |
| 4 | david_music | CA | active | 1 |
| 5 | emma_art | US | active | 1 |
| 5 | emma_art | US | active | 1 |
| 6 | frank_code | UK | suspended | 0 |
| 6 | frank_code | UK | suspended | 0 |
| 7 | grace_data | CA | deleted | 0 |
| 7 | grace_data | CA | deleted | 0 |
| ES | 1 | 0 | 0 |
| ES | 1 | 0 | 0 |