I have need the N minimum (index) values in a numpy array

后端 未结 5 802
孤独总比滥情好
孤独总比滥情好 2021-02-05 02:57

Hi I have an array with X amount of values in it I would like to locate the indexs of the ten smallest values. In this link they calculated the maximum effectively, How to get i

5条回答
  •  我寻月下人不归
    2021-02-05 03:26

    This code save 20 index of maximum element of split_list in Twenty_Maximum:

    Twenty_Maximum = split_list.argsort()[-20:]
    

    against this code save 20 index of minimum element of split_list in Twenty_Minimum:

    Twenty_Minimum = split_list.argsort()[:20]
    

提交回复
热议问题