title: Efficient numpy argsort with condition while maintaining original indices
body: <p>I'm wondering what the most efficient way to do an argsort of an array given a condition, while preserving the original index </p>
  
  <pre><code>import numpy as np
  
  x = np.array([0.63, 0.5, 0.7, 0.65])
  
  np.argsort(x)
  #Corrected argsort(x) solution
  Out[99]: array([1, 0, 3, 2])
  </code></pre>
  
  <p>I want to argsort this array with condition that x>0.6. Since 0.5 &lt; 0.6, index 1 should not be included.</p>
  
  <pre><code>x = np.array([0.63, 0.5, 0.7, 0.65])
  index = x.argsort()
  list(filter(lambda i: x[i] &gt; 0.6, index))
  
  [0,3,2]
  </code></pre>
  
  <p>This is inefficient since its not vectorized. </p>
  
  <p>EDIT:
  The filter will eliminate most of elements. So ideally, it filter first, then sort, while preserving original index. </p>