numpy get index of n largest values

Solutions on MaxInterview for numpy get index of n largest values by the best coders in the world

we are a community of more than 2 million smartest coders
registration for
employee referral programs
are now open
get referred to google, amazon, flipkart and more
register now
  
pinned-register now
showing results for - "numpy get index of n largest values"
Kari
21 Mar 2016
1numbers = np.array([1, 3, 2, 4])
2n = 2
3indices = (-numbers).argsort()[:n]