• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2175
  • Last Modified:

reversing output of numpy argsort

Hi,

I find it amazing that I can't find an answer online, but how do I use numpy argsort to sort in reverse order?  The documentation is sparse.

I'm sorting a simple array of numbers and need the sorted index values in descending order.

ideas?

Thanks!
0
ugeb
Asked:
ugeb
  • 4
  • 3
1 Solution
 
tailoreddigitalCommented:
I don't know a lot about Python, but ran across this, so i thought i'd toss it at you,

L2.reverse()

I grabbed this from page 17,
http://koen.me/research/teaching-asci/python-workshop-slides.pdf
0
 
ugebAuthor Commented:
Thanks, but that has nothing to do with numpy's argsort.  That's plain python but I'm using numpy's data structure.
0
 
tailoreddigitalCommented:
I apologise if i'm barking up the wrong tree, just trying to help,

Take a look here,
http://stackoverflow.com/questions/8445323/reverse-sort-and-argsort-in-python

This seems to be a solution.
0
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
ugebAuthor Commented:
Thanks, but I've been through all these pages already through extensive searching, and they don't address the actual issue. None of the pages I've found have answered my question.
0
 
tailoreddigitalCommented:
I wish i could help further but i can't. Hopefully another more qualified expert will help out.

Good luck.
0
 
ugebAuthor Commented:
Thanks anyway.  I'm having to take the longer path of converting to a list and then reversing, instead of the far more efficient path of argsort actually having a reverse argument!  Oh well.
0
 
ugebAuthor Commented:
Thanks anyway.  I'm having to take the longer path of converting to a list and then reversing, instead of the far more efficient path of argsort actually having a reverse argument!  Oh well.
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now