title: Converting Dictionary to CSV File - multiple values per key
body: <p>I have a dictionary with three keys, but each key has multiple values. </p>
  
  <pre><code>mydictionary = {'wave': [14.26661, 14.3583, 14.45, 14.54169, 14.63338, etc], 'flux': [2.092778, 1.188152, 2.130176, 3.201674, 2.043295, etc], 'unc': [0.7566527, 0.7157381, 0.7030209, 0.6992941, etc]}
  </code></pre>
  
  <p>I would like to save the dictionary to a csv in the following format.</p>
  
  <p>wave, flux, unc</p>
  
  <p>14.2666, 2.0927, 0.756</p>
  
  <p>14.35, 1.18,  0.715 </p>
  
  <p>With each key being a column header with each value in it's own row. Final csv should have 3 columns and 116/117 rows. </p>
  
  <p>This is the closest I have gotten, but the csv is only writing the first column, and is skipping lines.</p>
  
  <pre><code>with open(n + '_sp.csv', 'w') as f:
      w = csv.writer(f)
      w.writerow(['wavelength','flux', 'unc'])
      for key, values in mydictionary.items():
         for value in values:
             w.writerow([value])
  </code></pre>