Answers for "python numpy sort descending"

1

np.sort descending

array = np.array([7, 5, 3, 2, 6, 1, 4])

# Sort in ascending order
sorted_array = np.sort(array)
# [1, 2, 3, 4, 5, 6, 7]

# Reverse the sorted array
reverse_array = sorted_array[::-1]
# [7, 6, 5, 4, 3, 2, 1]
Posted by: Guest on April-08-2020
0

argsort in descending order numpy

avgDists.argsort()[::-1][:n]
Posted by: Guest on June-10-2020

Code answers related to "python numpy sort descending"

Python Answers by Framework

Browse Popular Code Answers by Language