Ivy Professional School
Rating
Learning/Python Data Drill #1

Retail Sales Revenue Analysis

Last updated

Find the total revenue generated by each product category using Python and Pandas.

PythonBeginnerPandasDataFrameGroupByAggregationSUM

Your Objective

Find the total revenue generated by each product category using Python and Pandas.

The Setup

Your dataset contains a sales_data DataFrame with order-level retail sales information, including product category, quantity, unit price, and order date.

Table Schema

sales_data
ColumnTypeKey / Notes
order_idINTUnique order ID
product_categoryVARCHAR(50)Product category name
quantityINTNumber of units sold
unit_priceFLOATPrice per unit
order_dateDATEDate of order

Sample Data

sales_data — 8 rows

order_idproduct_categoryquantityunit_priceorder_date
101Electronics2150002023-07-01
102Clothing512002023-07-02
103Electronics1250002023-07-03
104Grocery103002023-07-04
105Clothing315002023-07-05
106Grocery82502023-07-06
107Furniture1180002023-07-07
108Electronics3100002023-07-08

Your Task

Revenue Analysis: What is the total revenue generated by each product category? Your result table should have product_category and total_revenue columns.

Your output should look like this (partial example):

product_categorytotal_revenue
Electronics85000
Furniture18000
......
Explore Enterprise Solutions