NumPy argsort question

I

Ivan Lima

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,
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,575
Members
45,053
Latest member
billing-software

Latest Threads

Top