title: Write pandas row `i` and first row to csv
body: <p><strong>Set-up</strong></p>
  
  <p>I have a pandas dataframe <code>df</code> containing several rows and columns.</p>
  
  <p>Each row resembles an applicant <code>Pn</code> and each column the applicants answers <code>An</code> to questions <code>Qn</code>. E.g.</p>
  
  <pre><code>       | Q1 | Q2 | Q3 |
         ----------------
     P1  | A1 | A2 | A3 |
     P2  | A1 | A2 | A3 |
     P3  | A1 | A2 | A3 |
  </code></pre>
  
  <p>I obtain the answers per applicant in a for loop, iterating over columns for each row, </p>
  
  <pre><code>number_of_applications = len(df)
  for i in range(0,number_of_applications):
      var1 = df['var1'][i]
      var2 = df['var2'][i]
      var3 = df['var3'][i]
  </code></pre>
  
  <p>this works fine.</p>
  
  <hr>
  
  <p><strong>Problem</strong></p>
  
  <p>I want to write an applicant's answers and the respective column names to a csv file. So, for each applicant I want to write,</p>
  
  <pre><code>     | Q1 | Q2 | Q3 |
       ----------------
       | A1 | A2 | A3 |
  </code></pre>
  
  <p>to an applicant specific csv file. </p>
  
  <p>I'd like to do this inside the loop. </p>
  
  <hr>
  
  <p><strong>Current Code</strong></p>
  
  <pre><code>number_of_applications = len(df)
  for i in range(0,number_of_applications):
      path = 'mypath'
      os.chdir(path) 
      df.iloc[i].to_csv('name.csv',encoding='utf-8', index=False)
  </code></pre>
  
  <p>which yields a csv file looking like,</p>
  
  <pre><code>A1
  A2
  A3
  </code></pre>
  
  <p>so just the answers, vertically and no column names. </p>
  
  <p>How to get,</p>
  
  <pre><code>  | Q1 | Q2 | Q3 |
    ----------------
    | A1 | A2 | A3 |
  </code></pre>