NumPy argsort question

Discussion in 'Python' started by Ivan Lima, Apr 23, 2004.

  1. Ivan Lima

    Ivan Lima Guest

    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
    Ivan Lima, Apr 23, 2004
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. drife
    Replies:
    1
    Views:
    361
    Travis E. Oliphant
    Mar 1, 2006
  2. Duncan Smith
    Replies:
    3
    Views:
    418
    Duncan Smith
    Apr 25, 2007
  3. Replies:
    2
    Views:
    486
    Robert Kern
    Nov 13, 2007
  4. W. eWatson
    Replies:
    2
    Views:
    935
    W. eWatson
    Nov 23, 2009
  5. Tom Kacvinsky

    Installing numpy over an older numpy

    Tom Kacvinsky, Jun 15, 2012, in forum: Python
    Replies:
    1
    Views:
    347
    Miki Tebeka
    Jun 15, 2012
Loading...

Share This Page