title: Create list of tuples from 2d array
body: <p>I'm looking to create a list of tuples from a 2xn array where the first row is an ID and the second row is that IDs group assignment. I'd like to create a list of the IDs organized to their group assignments. </p>
  
  <p>For example:</p>
  
  <pre><code>array([[ 0.,  1.,  2.,  3.,  4.,  5.,  6.],
         [ 1.,  2.,  1.,  2.,  2.,  1.,  1.])
  </code></pre>
  
  <p>In the above example, ID 0 is assigned to group 1, ID 1 to group 2 and so on. The output list would look like:</p>
  
  <pre><code>a=[(0,2,5,6),(1,3,4)]
  </code></pre>
  
  <p>Does anyone have any creative, quick ways to do this?</p>
  
  <p>Thanks!</p>