3 A module for loading data from the Harry Potter wikipedia data set
7 from datetime import datetime
9 f = open('hp_wiki.tsv', 'r')
10 reader = csv.DictReader(f, delimiter='\t')
13 for fieldname in reader.fieldnames:
14 columns[fieldname] = []
19 # Convert timestamp from a string to a date:
20 row['timestamp'] = datetime.strptime(row['timestamp'], '%Y-%m-%d %H:%M:%S')
22 for fieldname, value in row.items():
23 columns[fieldname].append(value)