Write SQL and Python, run instantly in your browser, and track your progress.
You are a Finance Analyst at Hulu. The Revenue team needs to understand payment volume distribution across different payment methods and transaction statuses. Create a pivot table showing the total payment amounts by payment method and status.
| Column Name | Type |
|---|---|
| payment_id | int64 |
| user_id | int64 |
| amount | float64 |
| method | object |
You are a Finance Analyst at Hulu. The Revenue team needs to understand payment volume distribution across different payment methods and transaction statuses. Create a pivot table showing the total payment amounts by payment method and status.
| Column Name | Type |
|---|---|
| payment_id | int64 |
| user_id | int64 |
| amount | float64 |
| method | object |
| status | object |
| status | object |
| payment_id | user_id | amount | method | status |
|---|---|---|---|---|
| 1 | 101 | 15.99 | card | captured |
| 2 | 102 | 22.99 | paypal | captured |
| payment_id | user_id | amount | method | status |
|---|---|---|---|---|
| 1 | 101 | 15.99 | card | captured |
| 2 | 102 | 22.99 | paypal | captured |
| method | authorized | captured | chargeback | failed | refunded |
|---|---|---|---|---|---|
| apple_pay | 56.54 | 275.61 | 26.67 | 92.36 | 46.08 |
| card | 37.69 | 378.83 | 45.92 | 96 | 48.92 |
| google_pay | 69.19 |
| method | authorized | captured | chargeback | failed | refunded |
|---|---|---|---|---|---|
| apple_pay | 56.54 | 275.61 | 26.67 | 92.36 | 46.08 |
| card | 37.69 | 378.83 | 45.92 | 96 | 48.92 |
| google_pay | 69.19 |
4 rows returned.
4 rows returned.
1. Data Selection:
2. Reshaping:
3. Output:
1. Data Selection:
2. Reshaping:
3. Output:
| 3 |
| 3 |
| 103 |
| 103 |
| 15.99 |
| 15.99 |
| card |
| card |
| refunded |
| refunded |
| 4 | 104 | 9.99 | apple_pay | captured |
| 4 | 104 | 9.99 | apple_pay | captured |
| 5 | 105 | 15.99 | card | failed |
| 5 | 105 | 15.99 | card | failed |
| 6 | 106 | 22.99 | paypal | captured |
| 6 | 106 | 22.99 | paypal | captured |
| 323.41 |
| 323.41 |
| 29.70 |
| 29.70 |
| 86.52 |
| 86.52 |
| 18.33 |
| 18.33 |
| paypal | 17.60 | 386.08 | 43.57 | 39.08 | 32.86 |
| paypal | 17.60 | 386.08 | 43.57 | 39.08 | 32.86 |