Sort
Sort
Array Sorting
There are multiple ways in Numpy to sort an array, based on the requirement
using Python. Let’s try to understand them with the help of di�erent methods. In
this article, we will see How to sort a Numpy Array in Python.
Python3
import numpy as np
Output:
We can choose which type of sorting we want perform using the kind parameter
inside the sort function. We can either choose between quicksort, mergesort and
heapsort.
Python3
Output:
[[5 2 2 3 1]
[7 3 8 6 4]
[7 4 9 8 6]]
[[3 4 6 7 8]
[2 6 7 8 9]
[1 2 3 4 5]]
[[3 4 6 7 8]
[2 6 7 8 9]
[1 2 3 4 5]]