NumPy argsort question

Ivan Lima ivan at yahoo.com
Fri Apr 23 14:24:08 EDT 2004


  Hello,

  I have two 2-dimensional arrays A and B. I want to sort A along its
  columns (axis=1) and then sort B along its columns in the same order
  that A was sorted. 

  I tried:

        sorted_A = sort(A,1)
        sorted_B = take(B, argsort(A,1), 1)

  but my last statement returns an array with an extra dimension. If A
  is a 2x3 matrix I get a 2x2x3 matrix. What am I missing?

  Thanks a lot,
   
-- 
Ivan Lima - idl764 at yahoo dot com



More information about the Python-list mailing list