title: Adding custom Header and Footer in CSV generated using Pandas Dataframe
body: <p>I am writing the results of a query to a CSV file. However I am looking to add custom header <code>(H|10|27)</code> and footer <code>(F|&lt;row_count&gt;)</code></p>
  
  <p>I read related posts at SO but i couldn't find anything specific to python and pandas. Neither the documentation refers to this.</p>
  
  <p>I am not sure how to go about that:
  My code:</p>
  
  <pre><code>cs = connect_snowflake().cursor()
      try:
          cs.execute("select * from &lt;Tables&gt; where id in (20, 24,61);")
          datas = cs.fetchall()
          df = pd.DataFrame(datas)
          print(df.head(10))
          df.to_csv('P202461.csv', sep='|', header=False)
      finally:
          cs.close()
  </code></pre>
  
  <p>The footer here should be the total count of rows. Which I can fetch in a separate variable and pass it. 
  Any help would be appreciated. </p>