In [10]:
import csv
import hashlib
In [11]:
reader = list(csv.DictReader(open("./output/participants.csv", 'r')))
In [18]:
row_list = []
In [19]:
for row in reader:
m = hashlib.md5()
s = "".join([row['name'], row['login'], row['email']])
m.update(s)
row['id'] = m.hexdigest()
row_list.append(row)
In [20]:
row_list[0]
Out[20]:
In [21]:
len(reader)
Out[21]:
In [22]:
len(row_list)
Out[22]:
In [27]:
fieldnames = [
'id',
'name',
'first_name',
'last_name',
'login',
'email',
'company',
'in_coalition',
'location',
'state',
'country',
'location_x',
'location_y',
'in_california',
'in_usa',
'contributions',
'avatar_url',
'at_san_diego_2016_training'
]
In [28]:
writer = csv.DictWriter(open("./output/participants.csv", 'w'), fieldnames=fieldnames)
In [29]:
writer.writeheader()
In [30]:
writer.writerows(row_list)