title: Python: Add index an index value to each array element
body: <p>I'm trying to measure the precision and recall of a knn algorithm on the Iris dataset without using sklearn or something similar. My idea is to append both the predicted and the true values with an index, like that:</p>
  
  <pre><code>id = [i for i in range(1,len(np.asarray(y_pred))+1)]
  y_pred_id = np.insert(y_pred, 0, id)
  </code></pre>
  
  <p>then delete all not Zeros, or not ones… and match the Indices to get the amount of TP. Sadly the Code I came up with only appends the Array in length, has anybody an idea on how to make the id stay that we have a Dimension of (n,2)?
  EDIT: It would be great if one could do it without using a Pandas df.</p>
  
  <p>Thanks in Advance,</p>
  
  <p>Nikolas</p>