NumPy Tutorial · NumPy Tutorial
NumPy Array Sort
Learn all about NumPy Array Sort in this comprehensive tutorial.
5 min read intermediate
- •Sorting means putting elements in an ordered sequence.
- •If you use the sort() method on a 2-D array, both arrays will be sorted:
Sorting Arrays
Sorting means putting elements in an ordered sequence.
Ordered sequence is any sequence that has an order corresponding to elements, like numeric or alphabetical, ascending or descending.
The NumPy ndarray object has a function called sort(), that will sort a specified array.
python
Note: Note: This method returns a copy of the array, leaving the
original array unchanged.
You can also sort arrays of strings, or any other data type:
python
python
Sorting a 2-D Array
If you use the sort() method on a 2-D array, both arrays will be sorted:
python
Module quiz
2 questions1
Which of the following is true about NumPy Array Sort?
2
What is the most common pitfall when working with NumPy Array Sort?
Answer all questions to submit.