Summarise a file that is not clean

You are given a CSV of orders with columns `id`, `customer`, `amount`. About one row in fifty is unusable — a missing amount, a stray header repeated mid-file, an amount with a currency symbol in it. Produce total revenue per customer. The interesting part is not the sum; it is what you do about the rows you cannot use, and whether someone reading your output would know they existed. Pick one rule for bad rows, apply it consistently, and make the count visible in the output.

Part of the Python Fundamentals course~120 minutesEvidence: a write-upWe mark it against a checklist you can read first
01 · What counts as done

What you have to hand in

  • Revenue per customer, one row per customer.
  • A stated rule for unusable rows, applied consistently.
  • The count of skipped rows in the output itself, not only in the write-up.
  • A line saying which of skip, zero, or fail you chose and why.
02 · How it will be marked

The checklist, published before you start

We score your work against each line below, and every score has to quote the part of your work it is based on. You read all of it first, so you can argue with any score on the specifics.
  • The numbers are the numbers asked for30% of the grade

    The summary aggregates the right field over the right grouping.

    1. AbsentAggregates the wrong field, or groups by the wrong key.
    2. DevelopingRight idea, but the grouping or the total is off for some inputs.
    3. Competent— this is the pass markCorrect field, correct grouping, correct totals.
    4. StrongCorrect, and the author states the grain of the output in one line.
  • Imperfect rows are handled on purpose30% of the grade

    Rows that cannot be parsed are dealt with by a stated decision rather than by a crash or a silent skip.

    1. AbsentCrashes on a malformed row, or drops it with no trace.
    2. DevelopingSurvives bad rows, but the handling is implicit and unreported.
    3. Competent— this is the pass markBad rows are skipped or defaulted by an explicit, stated rule.
    4. StrongThe rule is stated, the count is reported, and the choice is justified against the alternatives.
  • The output says what it left out25% of the grade

    A total that silently excludes rows is a wrong total. The output makes the exclusion visible.

    1. AbsentThe total stands alone with no indication anything was dropped.
    2. DevelopingMentions exclusions in prose but not in the output.
    3. Competent— this is the pass markThe output carries the count of skipped rows alongside the figures.
    4. StrongCarries the count and enough detail to find the offending rows again.
  • A colleague could maintain it15% of the grade

    The script is decomposed into named steps that map onto the task.

    1. AbsentOne long block with no structure.
    2. DevelopingSome structure, but the reader must hold too much at once.
    3. Competent— this is the pass markNamed functions matching the steps of the task.
    4. StrongStructure makes the method obvious without the write-up.
03 · What this proves

The skills a pass would prove

Pass, and these skills count as proven, with this piece of work attached as the evidence.

This brief is part of the Python Fundamentals course

Starting it starts the course: every skill above, in the order they depend on each other, with this brief at the end as the thing you hand in — marked against the checklist you have just read and nothing else.

About three minutes to set up: what you want to do with Python Fundamentals, where you are starting from, and how many hours a week you actually have. The subject we already have from this page.Start the Python Fundamentals course
See the whole Python Fundamentals course, or every graded brief we run.

One cookie, so we can see which subjects people finish and where the site loses them — plus a replay of where you click. Nothing you type is recorded, and once you’re signed in the words on screen are blanked out too. No advertising, nothing sold. The detail.