Skip to content

Instantly share code, notes, and snippets.

@stevenvo
Last active March 16, 2021 08:23
Show Gist options
  • Save stevenvo/e3dad127598842459b68 to your computer and use it in GitHub Desktop.
Save stevenvo/e3dad127598842459b68 to your computer and use it in GitHub Desktop.
Sort array by nth column in Numpy
# sort array with regards to nth column
arr = arr[arr[:,n].argsort()]
@Lelik92
Copy link

Lelik92 commented Nov 16, 2020

Could I sort all matrix columns in descending order in similar way by using argsort()?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment