← Code

Data detective

Find the story hiding in a real data set.

Start1. Rows of data
For teachers Usually Years 9–10 · 6 lessons (and 2 optional)

A real data set in Python: read a CSV, count, average and find the biggest, draw a bar chart, clean messy data and check it with test cases, then build a dashboard.

  • Usually Years 9–10
  • Lessons 6 (and 2 optional)
  • Do first Console bridge: text in, text out
Teacher guide

Standards, in general: main focus: Trace algorithms for errors (8P06), Acquire and validate data (8P01), Analyse and visualise data (8P02), Validate algorithms and programs (10P06), Acquire, store and validate data (10P01), Analyse and visualise data (10P02); touches on: Model structured data (8P03). What this means

Reading data

Read a CSV file into a list of dictionaries, then count, filter, total and average it, then do the same jobs in pandas, with an optional look at numpy.

1Rows of dataNot started
2Totals and the biggestNot started
3The same job in pandasNot started

Do the last two lessons again with pandas: read the CSV into a table, then take an average, a maximum and a filtered table in one line each.

  1. Predict
  2. Run
  3. Investigate › Count the rock songs
  4. Investigate › Read the filter
  5. Modify
  6. Make
Start lesson
8Whole lists of numbers with numpy OptionalNot started

Turn a list of song lengths into a numpy array, then do sums on every number at once: times 60, an average, and a test that keeps only the long songs.

  1. Predict
  2. Run
  3. Investigate › Count the long songs
  4. Investigate › Read the filter
  5. Modify
  6. Make
Start lesson

Charts and checking

Draw a bar chart from counts, then clean messy data and check your code with test cases.

Dashboards and live data

Put the data behind a small app, then ask a real API for live data (optional).

6A data dashboardNot started
7Ask an API OptionalNot started

Ask a real weather service for the week's forecast, read the JSON it sends back, and fall back to a saved copy when there is no connection.

  1. Predict
  2. Run
  3. Investigate › The question you send
  4. Investigate › When it fails
  5. Investigate › Spot the bug
  6. Modify › The hottest day
  7. Modify › Rain
  8. Two places
  9. Where this leads
Start lesson

Project how-tos

Help for your own project. Open the one you need.

Progress is saved in this browser only. Nothing is sent anywhere.

For teachers: Teacher guide (notes, answers, solutions, slides and worksheets)