Course Content
NumPy in a Nutshell
1. Getting Started with NumPy
3. Indexing and Slicing
4. Important Functions
NumPy in a Nutshell
Sorting Arrays
Now let's move on to sorting arrays. Sorting an array is the allocation of array elements in an ordered sequence (the item can be sorted, for example in descending order, in ascending order, etc). Let's try to sort the array:
It's important to mention that, method
sort()
returns a copy of the array (original array remains unchanged).
Let's try to sort 2-D array.
Task
You have such an array:
[15, -2, 33, 47, -55, 16, 0, 834]
. You have to sort it.
Everything was clear?
Section 4. Chapter 4