title: Count duplicate rows in a csv using python
body: <p>I imagine this is an easy one for a decent Python dev - Im still learning! Given a csv with duplicate emails I would like to iterate and write out the count of duplicate emails eg:</p>
  
  <p><strong>infile.csv</strong> </p>
  
  <pre><code>COLUMN 0
  some@email.com
  some@email.com
  another@address.com
  example@email.com
  </code></pre>
  
  <p><strong>outfile.csv</strong></p>
  
  <pre><code>COLUMN 0                 COLUMN 1
  some@email.com           2
  another@address.com      1
  example@email.com        1
  </code></pre>
  
  <p>So far I can remove duplicates with </p>
  
  <pre><code>import csv
  
  f = csv.reader(open('infile.csv','rb'))
  writer = csv.writer(open('outfile.csv','wb'))
  emails = set()
  
  
  for row in f:
      if row[0] not in emails:
          writer.writerow(row)
          emails.add( row[0] )
  </code></pre>
  
  <p>but I am having trouble writing the count to a new column.</p>