title: Append rows from pandas df to a new csv while preserving the headers once?
body: <p>My goal is to open a very large csv file, read the file, then do stuff on the subset of data. In this case, "stuff" is writing to a blank csv, but in future it will be running functions on the data, 200 rows at a time (this saves computing time on my end for some reason, over running the entire csv through the functions).</p>
  
  <p>My current problem is that when I write a blank csv, if I use <code>header = False</code>, I have no headers, but if I take out that command, I have the header every 200 rows. I want the header once at the top if this is possible?  </p>
  
  <pre><code>with open(csvFile, encoding = 'utf8', errors = 'ignore') as csv_file:
  chunksize = 200
  i = 0
  j = 1
  for df in pd.read_csv(csv_file, encoding = 'utf-8', chunksize=chunksize, iterator=True):
        df.index += j
        i+=1
        df.to_csv('test.csv', mode = 'a', sep = ',', encoding='utf-8', header=False, index=False)
        j = df.index[-1] + 1  
  </code></pre>