title: How to write a pandas DataFrame to a CSV by fixed size chunks
body: <p>I need to output data from pandas into CSV files to interact with a 3rd party developed process.</p>
  
  <p>The process requires that I pass it no more than <code>100,000</code> records in a file, or it will cause issues (slowness, perhaps a crash).</p>
  
  <p>That said, how can I write something that takes a dataframe in pandas and splits it into 100,000 records frames?  Nothing would be different other than the exported dataframes would be subsets of the parent dataframe.</p>
  
  <p>I assume I could do a loop with something like this, but I assume it would be remarkably inefficient..</p>
  
  <p>First, taking <code>recordcount=len(df.index)</code> to get the number of records and then looping until I get there using something like</p>
  
  <pre><code>df1 = df[currentrecord:currentrecord+100000,]
  </code></pre>
  
  <p>And then exporting that to a CSV file</p>
  
  <p>There has to be an easier way.</p>