[SciPy-user] one-liner to retrieve indices of n smallest values from an array?

Aaron Hoover ahoover at eecs.berkeley.edu
Tue Oct 17 23:52:39 EDT 2006


Hi all,

Perhaps this is better suited for the NumPy list, but is there a  
simple (one line, perhaps) way to get the indices of the n smallest  
elements of an array? Something along the lines of argmin() that  
could take a parameter indicating
how many minimal values to return?

Thanks,
Aaron



More information about the SciPy-User mailing list