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
- Calling
- 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
- How many unique airport codes are in the data?
- What are the unique names of all the carriers?
- Which airport had the most flights in Dec 2015?
- Which had the most security delays in one month?
Tate (Art) Data¶
Download: Tate CSV File and Tate JSON File
- What is the oldest work of art in the collection?
- On average, how many words in are a work's title?
- Which artist has the most works of art in the data?
- How many unique artists in the data are still alive?