title: numpy beginner: writing an array using numpy.savetxt
body: <p>I have a numpy histogram that I would like to output as a tab-delimited text file. My code is below: </p>
  
  <pre><code>targethist = np.histogram(targetlist, bins=ilist)
  print targethist
  np.savetxt('ChrI_dens.txt',targethist,delimiter='\t')
  </code></pre>
  
  <p>targetlist and ilist are long lists of integers. I get the following output:</p>
  
  <blockquote>
    <p>(array([0, 0, 0, ..., 0, 0, 0]), array([       1,    10000,    20000,
    ..., 15060000, 15070000, 15072422])) Traceback (most recent call
    last):   File "target_dens_np.py", line 62, in 
        np.savetxt('ChrI_dens.txt',targethist,delimiter='\t')   File "/Library/Frameworks/Python.framework/Versions/7.3/lib/python2.7/site-packages/numpy/lib/npyio.py",
    line 979, in savetxt
        fh.write(asbytes(format % tuple(row) + newline)) TypeError: float argument required, not numpy.ndarray</p>
  </blockquote>
  
  <p>It seems that the histogram array has been created, but I have done something wrong in the np.savetxt() line. I have read the documentation, but don't understand why any of the arguments in this function would be expecting a float. Where have I gone wrong?</p>