2 Module for loading data from wikipedia_bios.csv.
6 from datetime import datetime
8 f = open('wikipedia_bios.csv', 'r')
9 reader = csv.DictReader(f, quoting=csv.QUOTE_NONNUMERIC)
13 for fieldname in reader.fieldnames:
14 columns[fieldname] = []
15 columns_female[fieldname] = []
16 columns_male[fieldname] = []
23 # Convert firstedit from a string to a date.
24 row['firstedit'] = datetime.strptime(row['firstedit'], '%Y-%m-%d %H:%M:%S')
26 if row['gender'] == 'female':
27 rows_female.append(row)
30 for fieldname, value in row.items():
31 columns[fieldname].append(value)
32 if row['gender'] == 'female':
33 columns_female[fieldname].append(value)
35 columns_male[fieldname].append(value)