Project library

Free project guide / Beginner

Build a Python CSV summary tool

Turn a small data file into a repeatable report, with sensible error messages.

2–4 practice sessions ยท suggested effort

What you'll make

A script that summarizes category totals and writes a new CSV.

01

Prepare a tiny input file

Create a CSV with the headers category,amount and five sample rows. Include repeated categories and one empty amount.

Checkpoint: You know what the correct category totals should be before writing code.

02

Read rows as named fields

Use Python's csv.DictReader. Validate the headers before processing. Open the file using a context manager and an explicit encoding.

Checkpoint: Print the category and amount for each row without relying on column positions.

03

Validate and summarize

Parse amounts with decimal.Decimal. Skip or report invalid rows with their row number; document your chosen policy. Accumulate a total for each category.

Checkpoint: An invalid number produces a readable message, and valid totals match your manual calculation.

04

Write a report

Use csv.DictWriter to write category,total rows to a separate output file. Accept the input and output paths with argparse.

Checkpoint: Run the same script on a different file without changing the source.

05

Package the project

Add a README, sample input, expected output, and checks for an empty file, missing headers, and invalid values.

Checkpoint: A new user can run your documented example from a clean folder.

Before you call it finished

Use this checklist to review your project. Sign in to save your checklist and continue from your dashboard.

Sign in to save progress

Document one thing that failed, how you investigated it, and what you would improve next.

Bring your questions to a conversation.

Explain your goal, what you tried, and where you got stuck. Check the available mentoring packages for scope and price.

Explore mentoring