Write SQL and Python, run instantly in your browser, and track your progress.
You are a Data Analyst at Amazon. The Operations team needs a summary view showing how orders are distributed across different fulfillment types and statuses. Create a pivot table that shows the count of orders for each combination of fulfillment type and order status.
| Column Name | Type |
|---|---|
| order_id | int64 |
| order_number | object |
| customer_id | int64 |
| order_datetime |
You are a Data Analyst at Amazon. The Operations team needs a summary view showing how orders are distributed across different fulfillment types and statuses. Create a pivot table that shows the count of orders for each combination of fulfillment type and order status.
| Column Name | Type |
|---|---|
| order_id | int64 |
| order_number | object |
| customer_id | int64 |
| order_datetime |
| object |
| object |
| status | object |
| status | object |
| fulfillment_type | object |
| fulfillment_type | object |
| total_amount | float64 |
| total_amount | float64 |
| order_id | order_number | customer_id | order_datetime | status | fulfillment_type | total_amount |
|---|---|---|---|---|---|---|
| 1 | ORD-001 | 101 | 2025-01-15 10:30:00 | delivered | ship | 249.99 |
| 2 |
| order_id | order_number | customer_id | order_datetime | status | fulfillment_type | total_amount |
|---|---|---|---|---|---|---|
| 1 | ORD-001 | 101 | 2025-01-15 10:30:00 | delivered | ship | 249.99 |
| 2 |
| fulfillment_type | canceled | confirmed | delivered | packed | partially_returned | placed | returned | shipped |
|---|---|---|---|---|---|---|---|---|
| digital | 0 | 2 | 1 | 0 | 0 | 0 | 0 | 1 |
| pickup | 0 |
| fulfillment_type | canceled | confirmed | delivered | packed | partially_returned | placed | returned | shipped |
|---|---|---|---|---|---|---|---|---|
| digital | 0 | 2 | 1 | 0 | 0 | 0 | 0 | 1 |
| pickup | 0 |
3 rows returned.
3 rows returned.
1. Data Selection:
2. Reshaping:
3. Output:
1. Data Selection:
2. Reshaping:
3. Output:
| ORD-002 |
| ORD-002 |
| 102 |
| 102 |
| 2025-01-16 14:45:00 |
| 2025-01-16 14:45:00 |
| shipped |
| shipped |
| ship |
| ship |
| 89.50 |
| 89.50 |
| 3 | ORD-003 | 103 | 2025-01-17 09:15:00 | delivered | pickup | 324.00 |
| 3 | ORD-003 | 103 | 2025-01-17 09:15:00 | delivered | pickup | 324.00 |
| 4 | ORD-004 | 104 | 2025-01-18 16:00:00 | canceled | ship | 45.00 |
| 4 | ORD-004 | 104 | 2025-01-18 16:00:00 | canceled | ship | 45.00 |
| 5 | ORD-005 | 105 | 2025-01-19 11:30:00 | delivered | digital | 19.99 |
| 5 | ORD-005 | 105 | 2025-01-19 11:30:00 | delivered | digital | 19.99 |
| 1 |
| 1 |
| 0 |
| 0 |
| 0 |
| 0 |
| 1 |
| 1 |
| 0 |
| 0 |
| 1 |
| 1 |
| 1 |
| 1 |
| ship | 3 | 8 | 21 | 4 | 4 | 4 | 5 | 18 |
| ship | 3 | 8 | 21 | 4 | 4 | 4 | 5 | 18 |