Skip to content

04-07: Sales Dashboard (Pandas + Matplotlib)

Python: Data Analytics

View the live site — ijk37.com

Project 07

Home  |  All Projects  |  Notes  |  Exercises  |  Quiz Hub

Merges a sales table with a products table using pd.merge(). Computes monthly revenue trends, category breakdowns, regional distribution, and top products. Generates a 4-panel dashboard chart saved as sales_dashboard.png.

Topics covered: pd.merge() · df.groupby().agg() · named aggregation · df.reindex() · vectorised Revenue = Qty × Cost · plt.subplots(2,2) · pie chart · line chart with fill

Difficulty: ⭐⭐⭐ Intermediate–Advanced


Requirements

pip install pandas matplotlib

How to Run

python main.py

Dashboard Panels

Panel Chart Type Shows
Top-left Line + fill Monthly revenue trend
Top-right Horizontal bar Revenue by category
Bottom-left Pie Revenue share by region
Bottom-right Vertical bar Top 5 products

Key Concepts Practised

Concept Where used
pd.merge(sales, products, on="ProductID") SQL-style JOIN
df["Quantity"] * df["UnitCost"] Vectorised revenue
groupby().agg(Revenue=(...), Units=(...)) Named aggregation
monthly.reindex(MONTHS_ORDER) Custom sort order
groupby().idxmax() / .head(n) Top products