Day 7: Tuesday, January 31, 2017 - Data serialization


Last week’s assignment has been split into 3 assignments due for Thursday. No quiz on Thursday.

Understand csv.reader, csv.DictReader, etc.

Understanding how text is deserialized into data objects, and vice versa, is key to doing data work. If you can’t turn text into data, you aren’t going to get very far:

csv - reading and writing delimited text data


JSON is just another data format, one that allows for data more complex that can be represented in a data row.

As far as we’re concerned, JSON is a text format that gets serialized into Python dictionaries and lists when we use Python’s json.load(). JSON’s readability and lightness is a big factor in why it’s the most popular data format for APIs today.

Example assignment from last year using Python’s json library to deserialize the JSON responses from Google’s geocoding API:

>>> import requests
>>> import json
>>> url = ''
>>> resp = requests.get(url)
>>> type(resp.text)
>>> mydata = json.loads(txt)
>>> type(mydata)
>>> mydata['status']
>>> len(mydata['results'])


Please sign up for these 3 free APIS by Thursday: