Skip to content

Nov 11: Data Scavenger Hunt

Learning Objectives

After today's class, you should be able to:

  • Demonstrate how to read/write lines from/to plain text files.
  • Read data files written in CSV and JSON format into memory.
  • Write short Python programs to answer questions from data.

Reminders

File I/O Review

  • Filename vs File object
    • Calling open() function
    • Using a with statement
  • Basic file I/O methods
    • Reading lines from a file
    • Writing lines to a file

Scavenger Hunt

  • Review the CSV/JSON examples from last week
  • Write code to answer each of the questions below
    • Round 1: Using the CSV file
    • Round 2: Using the JSON file
  • The data files are from the CORGIS project

Download the provided stubs:

Airlines Data

Download: Airlines CSV File and Airlines JSON File

  1. How many unique airport codes are in the data?
  2. What are the unique names of all the carriers?
  3. Which airport had the most flights in Dec 2015?
  4. Which had the most security delays in one month?

Tate (Art) Data

Download: Tate CSV File and Tate JSON File

  1. What is the oldest work of art in the collection?
  2. On average, how many words in are a work's title?
  3. Which artist has the most works of art in the data?
  4. How many unique artists in the data are still alive?