Reputation: 60341
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
?
Upvotes: 0
Views: 129
Reputation: 8658
You want to use numpy.argsort
argsortx = np.argsort(x)
x, y, z = x[argsortx], y[argsortx], z[argsortx]
Upvotes: 2