python - numpy data sorting problem
大家讲道理
大家讲道理 2017-05-18 10:46:48
0
1
696
import numpy as np 

x = np.array([3, 1, 2])

np.argsort(x)
Out[4]: array([1, 2, 0]) # 疑问点

In [13]:   x = np.array([6,5,4,3,2,1])

In [14]:

In [14]: np.argsort(x)
Out[14]: array([5, 4, 3, 2, 1, 0])

Why not[2,0,1]

大家讲道理
大家讲道理

光阴似箭催人老,日月如移越少年。

reply all(1)
为情所困

argsort returns the sorting of index values ​​
For np.argsort([3,1,2]), the corresponding index value is [0, 1, 2], so the sorted index value returns [1, 2, 0]

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template