Help us measure site usage?

With your permission, we use self-hosted analytics to understand page usage. It is optional and does not affect the Service. Learn more.

PythonbeginneraiAI generated

CSV Sales Data Summarizer

Write a Python script that turns a CSV file of sales records into a clear summary: total revenue, number of orders, average order value, the best-selling products and categories, and a chart of revenue month by month, saved as an image, plus a short written report. You'll use pandas to load and clean the data (fixing dates, removing duplicates and handling missing values) and to group and summarize it, and matplotlib to draw the chart. It's a great first data analysis project: you'll learn loading and inspecting data with pandas, cleaning messy data, groupby and aggregation, resampling by month, making a chart, and writing a report file.

Estimate
~6.5h
Steps
5
Completed by
0
Proposed by
codeseed.app

pandas · matplotlib

Project roadmap

  1. 01

    Load and clean the data

    ~1.5h

    Find a sample sales dataset (for example a public online retail or superstore dataset) or create one with columns for order id, date, product, category, quantity and unit price. Load it with pd.read_csv, parse the date column with pd.to_datetime, look at it with head(), info() and describe(), and clean it: drop exact duplicates, remove rows with missing or invalid values (such as negative quantities, noting how many), and add a revenue column (quantity × unit price). Done when: the cleaned data has the right types, and the number of removed rows is printed.

  2. 02

    Compute summary statistics

    ~1.5h

    Calculate the total revenue, the number of orders (unique order ids), the average order value (revenue per order, using groupby on the order id), and the top 10 products and the categories by revenue and by quantity with groupby and sort_values. Round money to 2 decimals. Done when: the statistics print correctly and match a quick check by hand on a few rows.

  3. 03

    Chart the monthly trend

    ~1.5h

    Group revenue by month (with resample('MS') on the date, or groupby on the month), and draw a line or bar chart with matplotlib: a title, labeled axes, readable month labels and the values formatted as money. Save it as monthly_revenue.png. Done when: the chart image shows the monthly revenue clearly.

  4. 04

    Write the report

    ~1h

    Write a report.md file with the key figures, the top products and categories as small tables (with DataFrame.to_markdown, which needs the tabulate package), the chart image, and two or three sentences about what stands out (such as the best month). Make the script take the input file and output folder as arguments with argparse. Done when: running the script produces the report and chart in the chosen folder.

  5. 05

    Test it

    ~1h

    Move the cleaning and summary steps into functions and write pytest tests with a small hand-made DataFrame: duplicates and invalid rows removed, revenue calculated, average order value, and monthly totals. Done when: pytest passes.

Ready to build this?

Get a GitHub repo and start building. Your AI reviewer checks each step as you go.

~6.5h · 5 steps

Tech stack

pandasmatplotlib