title: Pandas: Append existing CSV file, extra columns
body: <p>I'm trying to create csv file, save it, read it later and then add (<code>concat</code>) data to the bottom - and do this process multiple times.  As an example, my setup is:</p>
  
  <pre><code>import pandas as pd
  
  df3 = pd.DataFrame(columns=('col1','col2'))
  df3.to_csv('example.csv', sep=',')
  print(df3)
  </code></pre>
  
  <p>which generates a blank csv file only containing column headers that looks like this (this is what i want my data to look like):</p>
  
  <pre><code>Empty DataFrame
  Columns: [col1, col2]
  Index: []
  </code></pre>
  
  <p>Then, I generate a new dataframe with row information (index), open the old (<code>df3</code>) csv file and <code>.concat()</code> to the file.</p>
  
  <pre><code>df1 = pd.DataFrame({'col1':list("abc"),'col2':list("def")})
  df3 = pd.read_csv('example.csv', sep=',')
  print(df3)
  print(df1)
  df3 = pd.concat([df3, df1], ignore_index=True)
  print(df3)
  df3.to_csv('example.csv', sep=',')
  </code></pre>
  
  <p>but when I read the <code>example.csv</code> file (<code>df3</code>) it actually generates a dataframe that looks like this:</p>
  
  <pre><code>Empty DataFrame
  Columns: [Unnamed: 0, col1, col2]
  Index: []
  </code></pre>
  
  <p>There is now an extra column.  </p>
  
  <p>My actual code constrains the <code>.read_csv</code>/<code>.to_csv</code> and it throws an error because what I'm trying to read/write in isn't what I sent it (I don't think).</p>
  
  <p>I've tried adding <code>ignore_index=True</code> to the method but that doesn't do it.  I've also tried reading back exactly what I put in, but it still generates the <code>Unnamed</code> column.</p>
  
  <p>There is some information <a href="https://stackoverflow.com/questions/20062470/pandas-csv-file-with-occasional-extra-columns-in-the-middle">here</a> on bad data within the column - not quite on point.  </p>
  
  <p>There is obviously a simple answer to this, I just can't figure it out.</p>