performance (and performance guaranteesthis is not something that most users will ever have to think about but useful to know that it' there table - array sorting methods kind speed stable work space worst-case 'quicksort no ( 'mergesort yes / ( log 'heapsort no ( log nat the time of this writingsort algorithms other than quicksort are not available on arrays of python objects (dtype=objectthis means occasionally that algorithms requiring stable sorting will require workarounds when dealing with python objects numpy searchsortedfinding elements in sorted array searchsorted is an array method that performs binary search on sorted arrayreturning the location in the array where the value would need to be inserted to maintain sortednessin [ ]arr np array([ ]in [ ]arr searchsorted( out[ ] as you might expectyou can also pass an array of values to get an array of indices backin [ ]arr searchsorted([ ]out[ ]array([ ]you might have noticed that searchsorted returned for the element this is because the default behavior is to return the index at the left side of group of equal valuesin [ ]arr np array([ ]in [ ]arr searchsorted([ ]out[ ]array([ ]in [ ]arr searchsorted([ ]side='right'out[ ]array([ ]as another application of searchsortedsuppose we had an array of values between and , and separate array of "bucket edgesthat we wanted to use to bin the datain [ ]data np floor(np random uniform( size= )in [ ]bins np array([ ]in [ ]data advanced numpy www it-ebooks info