title: Python csv writer Combine two columns in single row
body: <p>I am trying to write <code>img_id</code> (single value) in first column of csv and image features array (<code>f_descriptor_T</code>) in remaining columns of csv file. 
  I have written following code: </p>
  
  <pre><code>path=/home/dir
  listing = os.listdir(path)    
  
  for file in listing:
      path_img_ext = os.path.join(path, file) #combine filename and extension
      data_read = feature_io.ReadFromFile(path_img_ext) #read single features of single image in each iteration 
  
      base=os.path.basename(file) #Extract image_id from its name
      os.path.splitext(file)
      img_id = os.path.splitext(base)[0]
  
      f_descriptor = data_read[2] #Extract particular array, from multiple arrays of features 
  
      feature_flat=f_descriptor.flatten() #Make flat array
  
      f_descriptor_T = np.array(feature_flat).T #Transpose feature array to convert col data to row form. 
  
      with open("output_0.csv", "a") as f:
          writer = csv.writer(f)
          writer.writerow([img_id])
          writer.writerow(f_descriptor_T)
  </code></pre>
  
  <p>Unfortunately, the output shows <code>img_id</code> on one row and <code>f_descriptor_T</code> on second row, with each iteration of loop, as shown in following screenshot: <a href="https://i.stack.imgur.com/t7Gnz.png" rel="nofollow noreferrer">Output</a></p>
  
  <p>But i want to combine both (variable and array) in single row. </p>
  
  <p>Note: I have tried zip and concatenate to combine both, but failed. </p>
  
  <p>The desired output should be like this: <a href="https://i.stack.imgur.com/g8vVD.png" rel="nofollow noreferrer">Desired Output</a>Not necessary to print column header, but just img_id and f_descriptor_T array in single row.  </p>