argsort()函数是将函数中的数据进行大小排序,然后按照其索引进行从小到大排序,默认是从小到大排序
from numpy import * a = [-9,0,3,-4,8,10] print(argsort(a)) 数据结果:[0 3 1 2 4 5]
本文介绍 NumPy 中的 argsort 函数,该函数能够返回数组中元素从小到大的索引值。通过一个简单的例子展示如何使用此函数,并解释其默认行为。
argsort()函数是将函数中的数据进行大小排序,然后按照其索引进行从小到大排序,默认是从小到大排序
from numpy import * a = [-9,0,3,-4,8,10] print(argsort(a)) 数据结果:[0 3 1 2 4 5]
7239

被折叠的 条评论
为什么被折叠?
