 <p>I may be completely off since I don't do a lot of work with unicode, but it seems to me that the following should work:</p> <pre><code>import csv with open('test.csv', 'ur') as csvin, open('test-write', 'uw') as csvout: reader = csv.DictReader(csvin) writer = csv.DictWriter(csvout, fieldnames=['Indv', 'AttrName', 'AttrValue', 'Start', 'End']) for row in reader: for traitnum in range(1, 4): key = "trait{}".format(traitnum) writer.writerow({'Indv': row['email'], 'AttrName': key, 'AttrValue': row[key]}) </code></pre>