Adding the header to a csv file
<p>I have a csv file with the dimensions <code>100*512</code> , I want to process it further in <code>spark</code>. The problem with the file is that it doesn't contain header i.e <code>column names</code> .  I need these column names for further ETL in <code>machine learning</code> . I have the column names in another file(text file). I have to put these column names as headers in the csv file mentioned above.
e.g.</p>

<p>CSV file :-</p>

<blockquote>
  <p>ab 1 23 sf 23 hjh</p>
  
  <p>hs 6 89 iu 98 adf</p>
  
  <p>gh 7 78 pi 54 ngj</p>
  
  <p>jh 5 22 kj 78 jdk</p>
</blockquote>

<p>Column headers file :-</p>

<blockquote>
  <p>one,two,three,four,five, six</p>
</blockquote>

<p>I want the output like this :-</p>

<blockquote>
  <p>one two three four five six</p>
  
  <p>ab   1   23    sf   23  hjh</p>
  
  <p>hs 6 89 iu 98 adf</p>
  
  <p>gh 7 78 pi 54 ngj</p>
  
  <p>jh 5 22 kj 78 jdk</p>
</blockquote>

<p>Please suggest some method to add the column heads to the CSV file.(Without replacing the row of the csv file.
I tried it by converting it to pandas dataframe but can't get the expected output.</p>

<p>Unix:</p>

<pre><code>cat header_file.csv data_file.csv &gt; data_file.csv
</code></pre>

<p>Windows:</p>

<pre><code>type header_file.csv data_file.csv &gt; data_file.csv
</code></pre>

python csv