title: How to combine two 1D lists into 2D array?
body: <p>I am trying to read mzXML files using Pyteomics' <code>mzxml</code> class. The elements that I need to access are in <code>numpy.ndarray</code> format, which I convert as lists. The mzXML files contain several columns with lists as values. The main objective is to combine the two lists into 2D array (side by side in column-wise) so that I can save as CSV files.</p>
  
  <p>I tried using <code>np.concatenate((mzplist, mzplist2), axis=1)</code>, which produced <code>axis=1</code> error saying that <code>axis=1</code> is out of bounds for 1D arrays. I also tried using <code>hstack</code>, <code>column_stack</code>. The closest I got was from <code>column_stack</code> (code below) but the resulting array was 1D when I viewed the resulting CSV files (each cell of Excel contains m/z value and intensity value separated by a space). </p>
  
  <pre><code>plist = []
  
  for files in os.listdir(full_path):
      filename = os.path.basename(files)
      with mzxml.read(full_path + '\\' + filename) as reader:
          for line in reader:
              mzplist = line['m/z array'].tolist()
              mzplist2 = line['intensity array'].tolist()
              print(type(mzplist))
              mzplist = np.column_stack([mzplist, mzplist2])
              #mzplist.columns = ['mass', 'Intensity']
              np.savetxt(newfolder + '\\' + filename + '.csv', mzplist) 
              plist = []
              mzplist = []
              mzplist2 = []
  </code></pre>
  
  <p>Expected results for <code>mzplist</code>:</p>
  
  <pre><code> Mass       Intensity
    1            2
    3            4
    5            6
  </code></pre>
  
  <p>Here <code>line['m/z array'].tolist()</code> yields a list <code>[1, 3, 5, ...]</code>, and <code>line['intensity array'].tolist()</code> yields a list <code>[2, 4, 6, ...]</code>.</p>
  
  <p>Am I missing something?</p>