in [ ]arr out[ ]array([[- - [- - - [- - - ] ] ]]you may notice that none of the sort methods have an option to sort in descending order this is not actually big deal because array slicing produces viewsthus not producing copy or requiring any computational work many python users are familiar with the "trickthat for list valuesvalues[::- returns list in reverse order the same is true for ndarraysin [ ]arr[:::- out[ ]array([ - - ] - - - ] - - - ]]indirect sortsargsort and lexsort in data analysis it' very common to need to reorder data sets by one or more keys for examplea table of data about some students might need to be sorted by last name then by first name this is an example of an indirect sortand if you've read the pandasrelated you have already seen many higher-level examples given key or keys (an array or values or multiple arrays of values)you wish to obtain an array of integer indices ( refer to them colloquially as indexersthat tells you how to reorder the data to be in sorted order the two main methods for this are argsort and numpy lexsort as trivial examplein [ ]values np array([ ]in [ ]indexer values argsort(in [ ]indexer out[ ]array([ ]in [ ]values[indexerout[ ]array([ ]as less trivial examplethis code reorders array by its first rowin [ ]arr randn( in [ ]arr[ values in [ ]arr out[ ]array([ [- - [- ] - ] - ]] advanced numpy www it-ebooks info