How do I get indices of N maximum values in a NumPy array?

后端 未结 18 1442
长情又很酷
长情又很酷 2020-11-22 04:25

NumPy proposes a way to get the index of the maximum value of an array via np.argmax.

I would like a similar thing, but returning the indexes of the

18条回答
  •  一个人的身影
    2020-11-22 04:46

    bottleneck has a partial sort function, if the expense of sorting the entire array just to get the N largest values is too great.

    I know nothing about this module; I just googled numpy partial sort.

提交回复
热议问题