You are a Category Manager at Amazon. The Merchandising team needs to understand the product distribution across categories for inventory planning. Count how many products exist in each category.
| Column Name | Type |
|---|---|
| product_id | int64 |
| sku | object |
| product_name | object |
| category | object |
| price | float64 |
| currency | object |
| is_active | int64 |
| weight_kg | float64 |
| created_at | object |
| product_id | sku | product_name | category | price | currency | is_active | weight_kg | created_at |
|---|---|---|---|---|---|---|---|---|
| 1 | SKU-10001 | Casper Original Mattress Queen | Home | 1095.0 | USD | 1 | 31.75 | 2025-02-14 10:57:38 |
| 2 | SKU-10002 | Dyson Supersonic Hair Dryer | Beauty | 429.99 | USD | 1 | 0.66 | 2025-02-27 07:20:29 |
| 3 | SKU-10003 | CalDigit TS4 Thunderbolt Dock | Office | 399.99 | USD | 1 | 0.5 | 2024-12-11 00:49:57 |
| 4 | SKU-10004 | Under Armour Tech 2.0 T-Shirt | Sports | 25.0 | USD | 1 | 0.15 | 2024-11-22 04:49:00 |
| 5 | SKU-10005 | Staples TRU RED Copy Paper 10-Ream | Office | 54.99 | USD | 1 | 22.68 | 2025-01-10 01:43:59 |
| category | product_count |
|---|---|
| Toys | 10 |
| Electronics | 9 |
| Home | 7 |
| Beauty | 6 |
| Sports | 6 |
Showing first 5 of 8 rows.
1. Grouping:
2. Aggregation:
3. Output:
Company names and logos are trademarks of their respective owners, used here only to describe the kind of data these companies work with. Let's Data Science is not affiliated with, endorsed by, or sponsored by any company shown. Practice problems are original works and are not real interview questions from these companies. Rights & takedowns.
You are a Category Manager at Amazon. The Merchandising team needs to understand the product distribution across categories for inventory planning. Count how many products exist in each category.
| Column Name | Type |
|---|---|
| product_id | int64 |
| sku | object |
| product_name | object |
| category | object |
| price | float64 |
| currency | object |
| is_active | int64 |
| weight_kg | float64 |
| created_at | object |
| product_id | sku | product_name | category | price | currency | is_active | weight_kg | created_at |
|---|---|---|---|---|---|---|---|---|
| 1 | SKU-10001 | Casper Original Mattress Queen | Home | 1095.0 | USD | 1 | 31.75 | 2025-02-14 10:57:38 |
| 2 | SKU-10002 | Dyson Supersonic Hair Dryer | Beauty | 429.99 | USD | 1 | 0.66 | 2025-02-27 07:20:29 |
| 3 | SKU-10003 | CalDigit TS4 Thunderbolt Dock | Office | 399.99 | USD | 1 | 0.5 | 2024-12-11 00:49:57 |
| 4 | SKU-10004 | Under Armour Tech 2.0 T-Shirt | Sports | 25.0 | USD | 1 | 0.15 | 2024-11-22 04:49:00 |
| 5 | SKU-10005 | Staples TRU RED Copy Paper 10-Ream | Office | 54.99 | USD | 1 | 22.68 | 2025-01-10 01:43:59 |
| category | product_count |
|---|---|
| Toys | 10 |
| Electronics | 9 |
| Home | 7 |
| Beauty | 6 |
| Sports | 6 |
Showing first 5 of 8 rows.
1. Grouping:
2. Aggregation:
3. Output:
Company names and logos are trademarks of their respective owners, used here only to describe the kind of data these companies work with. Let's Data Science is not affiliated with, endorsed by, or sponsored by any company shown. Practice problems are original works and are not real interview questions from these companies. Rights & takedowns.
Write SQL and Python, run instantly in your browser, and track your progress.