Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Sorting Arrays | Important Functions
NumPy in a Nutshell
course content

Conteúdo do Curso

NumPy in a Nutshell

NumPy in a Nutshell

1. Getting Started with NumPy
2. Dimensions in Arrays
3. Indexing and Slicing
4. Important Functions

bookSorting Arrays

Now, let's dive into sorting arrays. Sorting an array involves arranging its elements in a specific order, whether it's ascending, descending, or some other sequence.

Let's try to sort the array:

123456
import numpy as np array = np.array([3, -4, 6, 0, 12, 499, -123]) print('unsorted array', array) print('sorted array', np.sort(array))
copy

Note

The sort() function returns a copy of the array, while the original array remains unchanged.

Let's try to sort a 2-D array:

12345
import numpy as np array = np.array([[-2, 4, -12, -434, 62], [1, 4, 7, 93, 75]]) print('Unsorted array', array) print('Sorted array', np.sort(array))
copy
Tarefa
test

Swipe to show code editor

You have the following array: [15, -2, 33, 47, -55, 16, 0, 834]. Your task is to sort it.

Switch to desktopMude para o desktop para praticar no mundo realContinue de onde você está usando uma das opções abaixo
Tudo estava claro?

Como podemos melhorá-lo?

Obrigado pelo seu feedback!

Seção 4. Capítulo 4
toggle bottom row

bookSorting Arrays

Now, let's dive into sorting arrays. Sorting an array involves arranging its elements in a specific order, whether it's ascending, descending, or some other sequence.

Let's try to sort the array:

123456
import numpy as np array = np.array([3, -4, 6, 0, 12, 499, -123]) print('unsorted array', array) print('sorted array', np.sort(array))
copy

Note

The sort() function returns a copy of the array, while the original array remains unchanged.

Let's try to sort a 2-D array:

12345
import numpy as np array = np.array([[-2, 4, -12, -434, 62], [1, 4, 7, 93, 75]]) print('Unsorted array', array) print('Sorted array', np.sort(array))
copy
Tarefa
test

Swipe to show code editor

You have the following array: [15, -2, 33, 47, -55, 16, 0, 834]. Your task is to sort it.

Switch to desktopMude para o desktop para praticar no mundo realContinue de onde você está usando uma das opções abaixo
Tudo estava claro?

Como podemos melhorá-lo?

Obrigado pelo seu feedback!

Seção 4. Capítulo 4
toggle bottom row

bookSorting Arrays

Now, let's dive into sorting arrays. Sorting an array involves arranging its elements in a specific order, whether it's ascending, descending, or some other sequence.

Let's try to sort the array:

123456
import numpy as np array = np.array([3, -4, 6, 0, 12, 499, -123]) print('unsorted array', array) print('sorted array', np.sort(array))
copy

Note

The sort() function returns a copy of the array, while the original array remains unchanged.

Let's try to sort a 2-D array:

12345
import numpy as np array = np.array([[-2, 4, -12, -434, 62], [1, 4, 7, 93, 75]]) print('Unsorted array', array) print('Sorted array', np.sort(array))
copy
Tarefa
test

Swipe to show code editor

You have the following array: [15, -2, 33, 47, -55, 16, 0, 834]. Your task is to sort it.

Switch to desktopMude para o desktop para praticar no mundo realContinue de onde você está usando uma das opções abaixo
Tudo estava claro?

Como podemos melhorá-lo?

Obrigado pelo seu feedback!

Now, let's dive into sorting arrays. Sorting an array involves arranging its elements in a specific order, whether it's ascending, descending, or some other sequence.

Let's try to sort the array:

123456
import numpy as np array = np.array([3, -4, 6, 0, 12, 499, -123]) print('unsorted array', array) print('sorted array', np.sort(array))
copy

Note

The sort() function returns a copy of the array, while the original array remains unchanged.

Let's try to sort a 2-D array:

12345
import numpy as np array = np.array([[-2, 4, -12, -434, 62], [1, 4, 7, 93, 75]]) print('Unsorted array', array) print('Sorted array', np.sort(array))
copy
Tarefa
test

Swipe to show code editor

You have the following array: [15, -2, 33, 47, -55, 16, 0, 834]. Your task is to sort it.

Switch to desktopMude para o desktop para praticar no mundo realContinue de onde você está usando uma das opções abaixo
Seção 4. Capítulo 4
Switch to desktopMude para o desktop para praticar no mundo realContinue de onde você está usando uma das opções abaixo
We're sorry to hear that something went wrong. What happened?
some-alt