title: Adding index to numpy arrays
body: <p>I have a <code>numpy</code> array as:</p>
  
  <pre><code>prob_rf = [[0.4, 0.4, 0.4], 
             [0.5, 0.5, 0.5], 
             [0.6, 0.6, 0.6]]
  </code></pre>
  
  <p>I want to add an index number to each of the inner arrays as:</p>
  
  <pre><code>prob_rf = [[1, 0.4, 0.4, 0.4],
             [2, 0.5, 0.5, 0.5],
             [3, 0.6, 0.6, 0.6]]
  </code></pre>
  
  <p>and then save this array into a <code>csv</code> file using <code>numpy.savetxt</code>.</p>
  
  <p>I am currently doing this as:</p>
  
  <pre><code>    id = [i for i in xrange(1,len(prob)+1)]
      prob_rf = np.insert(prob_rf, 0, id, axis=1)
      np.savetxt("foo.csv", prob_rf, delimiter=",", fmt='%1.1f')
  </code></pre>
  
  <p>But this is giving the output as </p>
  
  <pre><code>[[1.0, 0.4, 0.4, 0.4], 
   [2.0, 0.5, 0.5, 0.5], 
   [3.0, 0.6, 0.6, 0.6]]
  </code></pre>
  
  <p>Could someone please tell me how do I get the output as </p>
  
  <pre><code>[[1, 0.4, 0.4, 0.4], 
   [2, 0.5, 0.5, 0.5], 
   [3, 0.6, 0.6, 0.6]]
  </code></pre>