title: How can I combine two csv files into one, by adding one column to the end of the first one?
body: <p>I simply need to add the column of the second CSV file to the first CSV file.</p>
  <p>Example CSV file #1</p>
  <blockquote>
  <p>Time Press RH Dewpt Alt</p>
  <p>Value  Value Value Value Value</p>
  </blockquote>
  <p>For N number of rows.</p>
  <p>Example CSV file #2</p>
  <blockquote>
  <p>SmoothedTemperature</p>
  <p>Value</p>
  </blockquote>
  <p>I simply want to make it</p>
  <blockquote>
  <p>Time Press RH Dewpt Alt SmoothedTemperature</p>
  <p>Value  Value Value Value Value Value</p>
  </blockquote>
  <p>Also one has headers the other does not.</p>
  <p>Here is sample code of what I have so far, however the output is the final row of file 1 repeated with the full data set of File #2 next to it.</p>
  <pre><code>##specifying what they want to open
  File = open(askopenfilename(), 'r')
  ##reading in the other file
  
  Averaged = open('Moving_Average_Adjustment.csv','r')
  ##opening the new file via raw input to write to
  filename = raw_input(&quot;Enter desired filename, EX: YYYYMMDD_SoundingNumber_Time.csv; must end in csv&quot;)
  New_File = open(filename,'wb')
  
  
  
  R = csv.reader(File, delimiter = ',')
  
  ## i feel the issue is here in my loop, i don't know how to print the first columns
  ## then also print the last column from the other CSV file on the end to make it mesh well
  
  Write_New_File = csv.writer(New_File)
      data = [&quot;Time,Press,Dewpt,RH,Alt,AveragedTemp&quot;]
      Write_New_File.writerow(data)
      for i, line in enumerate(R):
          if i &lt;=(header_count + MovingAvg/2):
              continue
      Time,Press,Temp,Dewpt,RH,Ucmp,Vcmp,spd,Dir,Wcmp,Lon,Lat,Ele,Azi,Alt,Qp,Qt,Qrh,Qu,Qv,QdZ=line
  for i, line1 in enumerate(Averaged):
      if i == 1:
          continue
      SmoothedTemperature = line1
  Calculated_Data = [Time,Press,Dewpt,RH,Alt,SmoothedTemperature]
  Write_New_File.writerow(Calculated_Data)
  </code></pre>