Write SQL and Python, run instantly in your browser, and track your progress.
You are a Revenue Operations Analyst at Stripe. The Billing team needs to understand how subscriptions are distributed across payment methods and subscription statuses. Use groupby with unstack to create a cross-tabulation showing subscription counts.
| Column Name | Type |
|---|---|
| subscription_id | int64 |
| org_id | int64 |
| plan_id | int64 |
| status | object |
You are a Revenue Operations Analyst at Stripe. The Billing team needs to understand how subscriptions are distributed across payment methods and subscription statuses. Use groupby with unstack to create a cross-tabulation showing subscription counts.
| Column Name | Type |
|---|---|
| subscription_id | int64 |
| org_id | int64 |
| plan_id | int64 |
| status | object |
| payment_method | object |
| payment_method | object |
| seats_purchased | int64 |
| seats_purchased | int64 |
| subscription_id | org_id | plan_id | status | payment_method | seats_purchased |
|---|---|---|---|---|---|
| 1 | 101 | 1 | active | card | 10 |
| 2 | 102 | 2 | active |
| subscription_id | org_id | plan_id | status | payment_method | seats_purchased |
|---|---|---|---|---|---|
| 1 | 101 | 1 | active | card | 10 |
| 2 | 102 | 2 | active |
| payment_method | active | canceled | past_due | suspended | trialing |
|---|---|---|---|---|---|
| ach | 11 | 1 | 1 | 1 | 5 |
| card | 16 | 5 | 4 | 2 | 2 |
| invoice | 6 |
| payment_method | active | canceled | past_due | suspended | trialing |
|---|---|---|---|---|---|
| ach | 11 | 1 | 1 | 1 | 5 |
| card | 16 | 5 | 4 | 2 | 2 |
| invoice | 6 |
3 rows returned.
3 rows returned.
1. Data Selection:
2. Reshaping:
3. Output:
1. Data Selection:
2. Reshaping:
3. Output:
| ach |
| ach |
| 25 |
| 25 |
| 3 | 103 | 1 | canceled | card | 5 |
| 3 | 103 | 1 | canceled | card | 5 |
| 4 | 104 | 3 | active | invoice | 100 |
| 4 | 104 | 3 | active | invoice | 100 |
| 5 | 105 | 2 | past_due | card | 15 |
| 5 | 105 | 2 | past_due | card | 15 |
| 6 | 106 | 1 | active | ach | 20 |
| 6 | 106 | 1 | active | ach | 20 |
| 2 |
| 2 |
| 0 |
| 0 |
| 3 |
| 3 |
| 1 |
| 1 |