title: undo or reverse argsort(), python
body: <p>Given an array 'a' I would like to sort the array by columns <code>sort(a, axis=0)</code> do some stuff to the array and then undo the sort. By that I don't mean re sort but basically reversing how each element was moved. I assume <code>argsort()</code> is what I need but it is not clear to me how to sort an array with the results of <code>argsort()</code> or more importantly apply the reverse/inverse of <code>argsort()</code></p>
  
  <p>Here is a little more detail</p>
  
  <p>I have an array <code>a</code>, <code>shape(a) = rXc</code> I need to sort each column</p>
  
  <pre><code>aargsort = a.argsort(axis=0)  # May use this later
  aSort = a.sort(axis=0)
  </code></pre>
  
  <p>now average each row</p>
  
  <pre><code>aSortRM = asort.mean(axis=1)
  </code></pre>
  
  <p>now replace each col in a row with the row mean.
  is there a better way than this</p>
  
  <pre><code>aWithMeans = ones_like(a)
  for ind in range(r)  # r = number of rows
      aWithMeans[ind]* aSortRM[ind]
  </code></pre>
  
  <p>Now I need to undo the sort I did in the first step. ????</p>