Lecture 27 — Tables, Cleaning, and Anomalies

Position in the course

This is lecture 27 of 32. It belongs to the course arc described in the course outline and uses the standard interactive case method: display, attempt (5 minutes), discuss, reveal, name the technique.

This lecture runs as a workshop session (build-heavy; see the timing plan), not the standard four-case rhythm.

Learning objectives

By the end of this lecture students can do all three under time pressure, which is what the four cases exercise.

Prerequisite knowledge

Before this lecture: Lectures 10–13 — strings, lists, dictionaries

Assumed fluencies:

Preparation task: Find two real data-entry errors in any form you use; classify them.

Detailed topic outline

Core (mandatory):

  1. auditing a table before analysing it
  2. validation rules and their order
  3. boundaries in graded data
  4. entity resolution without unique IDs

Extension (optional enrichment):

  1. time-series anomalies and dropouts
  2. report the cleaning, always

Case sequence

CaseTitleDifficulty
cs-105The Room Booking AuditBeginner
cs-106The Grade TyposFoundational
cs-107The Duplicate StudentsIntermediate
cs-140The Sliced AnomalyIntermediate
cs-108The Sensor DropoutAdvanced

Display each case full-screen from the student page (cases cs-105–cs-108); instructor pages cs-105–cs-108 under case-studies/instructor/ hold the full solutions, reveal guides, and discussion prompts. Applied additions cs-140 extend the session as optional extra attempts or homework; they share the lecture's theme but teach an applied, real-world angle.

Timing plan (120 minutes)

Format: workshop session — deliberately not the standard case rhythm.

MinutesSegment
0–10Framing: the two patterns this workshop trains
10–45Cases 1–2 (cs-105, cs-106): two 5-minute attempts back to back, one joint discussion, two reveals
45–50Break
50–90Cases 3–4 (cs-107, cs-108): same double rhythm, harder material
90–110Deliberate-practice block: build or trace one of today's patterns end to end, instructor circulating
110–120Synthesis, exit questions, homework

Timing flexes with the room: if a case ignites the class, let the discussion run and compress the synthesis; if the attempts stall, harvest partial attempts rather than extending the clock.

Worked examples

Instructor demonstration to open the lecture: Room booking audit (cs-105): clean one week of bookings on the board with every rule reported in a public tally.

Classroom activities

#ActivityMinutesFormat and prompt
1Audit stations15Three tables rotate between pairs; each station adds a rule to a shared cleaning report.
2Key ladder debate7cs-107's matching keys ranked by precision; false merges are the cost of each.
3Gap or spike5Six time-series excerpts classified: dropout, anomaly, or legitimate quiet period.

Board plan

Instructor explanation notes

Reading the room. The second workshop of Block IV: real-shaped dirtiness is the material. Every cleaning action is reported — the public tally is the integrity lesson.

Running the reveal. Entity resolution (cs-107) is the hardest thinking; the key ladder makes it discussable without any fancy tooling.

Lecture focus. One sentence to repeat verbatim: Clean nothing silently; report every rule and its toll.

Common misconceptions

Each case's instructor page lists the specific wrong turn to expect; the reveal should address it by name.

Student practice exercises

Core:

  1. Audit the room bookings (cs-105): write every violated rule and its row references.
  2. Fix grade typos (cs-106) under the first-failure rule; log each fix.
  3. Propose a key ladder (cs-107) for the duplicate students and estimate its false-merge risk.

Enrichment (optional):

Formative assessment

Exit questions (choose one; answer on a card in 60 seconds):

  1. Why report every cleaning rule? Expected: silence is falsification of the analysis; the tally is the audit trail
  1. What is a false merge in cs-107? Expected: two different students collapsed by a weak matching key
  1. When is a gap an anomaly? Expected: when it breaks the series' established rhythm — context decides

Cards are skimmed before the next lecture; three answers become the framing. Persistent wrong answers route students to the review stations of lecture 16 or to office hours.

Homework and preparation

Learning-outcome mapping

Differentiation