title: How to unsort a np array given the argsort
body: <p>I intially have an unsorted np array of arrays</p>
  
  <pre><code>test = np.array([['A', 'A', 'B', 'E', 'A'],
         ['B', 'E', 'A', 'E', 'B'],
         ['C', 'D', 'D', 'A', 'C'],
         ['B', 'D', 'A', 'C', 'A'],
         ['B', 'A', 'E', 'A', 'E'],
         ['C', 'D', 'C', 'E', 'D']])
  </code></pre>
  
  <p>To sort the array based on the first column:</p>
  
  <pre><code>argsortTest = test[:,0].argsort()
  test_sorted = test[argsortTest]
  
    test_sorted:  
  [['A' 'A' 'B' 'E' 'A']
   ['B' 'E' 'A' 'E' 'B']
   ['B' 'D' 'A' 'C' 'A']
   ['B' 'A' 'E' 'A' 'E']
   ['C' 'D' 'D' 'A' 'C']
   ['C' 'D' 'C' 'E' 'D']]
  </code></pre>
  
  <p>I make some processing over <code>test_sorted</code> array changing some values (the first column remains intact and the number of rows unchanged). In the end I want to retrieve the orginal array of arrays keeping the changed values. So I need to 'unsort' it again based on first column</p>
  
  <p>My solution so far:</p>
  
  <pre><code>argsortTestList = argsortTest.tolist()
  rangeX = np.array(xrange(6))
  unsort_args = [argsortTestList.index(x) for x in rangeX]
  unsorted = test_sorted[unsort_args]
  </code></pre>
  
  <p>The reason I do sort and then unsort in the end is because I got better performance when working on the sorted array. However as the changes done are not reflected in the original array, I have to unsort it again.</p>
  
  <p>However the 'unsorting' solution is too slow (large dataset: around 200K rows) </p>