🐍 Python for Everyone

← Back to interview questions

Chapter 24 Project 55 min build

Sales-Data Dashboard (CSV In, Insights Out)

A menu-driven mini-app that loads a sales dataset with pandas and turns it into a real business report: total revenue, top products and regions via .groupby(), and underperforming line items via boolean filtering — all built on top of one pandas DataFrame parsed from CSV-format text.

Example run

Output
=== Sales-Data Dashboard ===

=== Total Revenue ===
$10,304

=== Top Products by Revenue ===
Widget: $4,110
Gizmo: $3,420
Gadget: $2,774

=== Top Regions by Revenue ===
East: $7,164
West: $3,140

=== Underperforming Line Items (revenue < $600) ===
2026-01-06 Widget West: $540
2026-01-07 Gizmo West: $270
2026-01-08 Gadget West: $570
How to run Download starter.py below into an empty folder, install pandas if you haven't already (pip install pandas), then run python3 starter.py.

The pieces

Ideas to make it your own

Why this project matters

Nearly every real "turn this spreadsheet into a report" task — sales, donations, survey responses, expenses — follows this exact shape: load tabular data, compute totals, break totals down by group, and flag outliers with a condition. This project builds that entire pattern once, on business data concrete enough to reason about intuitively.

More project ideas

From Chapter 7 onward, you get a genuine choice of what to build. The Sales-Data Dashboard above is fully built out with a starter and reference solution — the four ideas below are not. Each is a real, grounded use case solvable with only what's been taught through Chapter 24. No starter or solution files are provided on purpose — building one of these unassisted is the point.

1 A Student-Grades Gradebook Analyzer

Problem: A teacher has a CSV of student names, subjects, and scores, and wants a per-student and per-subject breakdown.

What it should do: Load the data into a DataFrame, report each student's average score (groupby('student')), each subject's class average (groupby('subject')), and flag students below a passing threshold using boolean filtering.

Suggested approach: Almost a direct re-skin of Chapter 23's Grade & Statistics Analyzer, but built on a DataFrame instead of a raw NumPy grid — a good chance to feel the difference directly.

2 A Simple Expense Tracker

Problem: Someone wants to track personal expenses by category (groceries, rent, entertainment) and see where their money is going.

What it should do: Load a CSV of date, category, amount rows, report total spending per category (groupby('category')), the single largest expense, and total spending for the month.

Suggested approach: Nearly identical structure to this project's top_products()/top_regions() pattern, just with "category" instead of "product."

3 A Weather-Data Trend Summarizer

Problem: Someone has a CSV of daily temperature readings across several cities and wants a quick trend summary.

What it should do: Load the data, report each city's average temperature (groupby('city')), the single hottest and coldest reading overall, and flag any reading above a heat-warning threshold using boolean filtering.

Suggested approach: Directly reuses this project's groupby-then-filter structure — "city" instead of "product," "reading" instead of "sale."

4 A Survey-Response Analyzer

Problem: A CSV of survey responses (respondent, question, rating 1-5) needs summarizing into an average rating per question.

What it should do: Load the data, report the average rating per question (groupby('question')), the count of each rating value per question, and flag any question whose average rating is below a "needs attention" threshold.

Suggested approach: .groupby('question')['rating'].mean() is the core operation; .value_counts() handles the per-rating counts.

← Interview Questions All Chapters →