Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

.argsort() python

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

>>> ind = np.argsort(x, axis=1)  # sorts along last axis (across)
>>> ind
array([[0, 1],
       [0, 1]])
>>> np.take_along_axis(x, ind, axis=1)  # same as np.sort(x, axis=1)
array([[0, 3],
       [2, 2]])
Source by docs.scipy.org #
 
PREVIOUS NEXT
Tagged: #python
ADD COMMENT
Topic
Name
9+6 =