Answers for "sort a list keeping index value in python"

0

sort a list keeping index value in python

import numpy
s = numpy.array([2, 3, 1, 4, 5])
sort_index = numpy.argsort(s)
print(sort_index)

Input: [1, 2, 3, 4, 5] 
Output: [2, 0, 1, 3, 4]
Posted by: Guest on August-31-2021

Code answers related to "sort a list keeping index value in python"

Python Answers by Framework

Browse Popular Code Answers by Language