0

Consider that I load columns from a text file using:

x, y, z = np.loadtxt(myfile, unpack=True)

What would be the syntax to sort x, y and z by increasing values of x ?

1 Answer 1

2

You want to use numpy.argsort

argsortx = np.argsort(x)
x, y, z = x[argsortx], y[argsortx], z[argsortx]
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.