title: Add a Column to an existing CSV file with Python
body: <p>I'm trying to add a new column header and values to an existing csv file with python. Every thing I've looked up appends the header to the last row of the last column.  This is what I want my results to be essentially.</p>
  
  <p><code>Header   Header2   Header3  NewHeader
   Value    Value2    Value3   NewValue</code></p>
  
  <p>What I'm currently getting is this:</p>
  
  <pre><code>Header   Header2   Header3
  Value    Value2    Value3**NewHeader
  NewValue`
  </code></pre>
  
  <p>This is my code:</p>
  
  <pre><code>import csv
    with open('filename.csv', 'a') as csvfile:
    fieldnames = ['pageviewid']
    writer = csv.DictWriter(csvfile, fieldnames=fieldnames)
  
    writer.writeheader()
    writer.writerow({'pageviewid': 'Baked'})
    writer.writerow({'pageviewid': 'Lovely'})
    writer.writerow({'pageviewid': 'Wonderful'})
  </code></pre>