浅谈numpy.argsort()第一个参数a
1:Help文档:
numpy.argsort = argsort(a, axis=-1, kind='quicksort', order=None)
a : array_like Array to sort.
Perform an indirect sort along the given axis using the algorithm specified by the `kind` keyword. It returns an array of indices of the same shape as `a` that index data along the given axis in sorted order.
parameter a | return value |
---|---|
a=numpy.array(['a','t','h']) | array([0, 2, 1]) |
a=numpy.array(['10','30','20']) | array([0, 2, 1]) |
a=numpy.array([10,30,20]) | array([0, 2, 1]) |
a=[10,30,20] | array([0, 2, 1]) |
a=['10','30','20'] | array([0, 2, 1]) |
a=['a','t','h'] | array([0, 2, 1]) |
a=(10,30,20) | array([0, 2, 1]) |
a=('10','30','20') | array([0, 2, 1]) |
a=('a','t','h') | array([0, 2, 1]) |
>>> numpy.argsort(a.keys()) | |
|