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

Contenido del 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

Copying Arrays

It's worth noting that NumPy offers various methods for duplicating arrays. In this section, we'll explore one of these methods, namely: .copy().

Note

The .copy() method creates a new array with the data from the original one.

Using the .copy() method:

123456789
import numpy as np arr = np.array([7, 43, 56, 123, 10, 3]) x = arr.copy() arr[0] = 42 print(arr) print(x)
copy

Tarea

You have the following array: [12, 56, 78, 65, 1, 5].

You have to obtain the following arrays using the correct method: arr_1 = [11, 56, 78, 0, 1, 5] arr_2 = [12, 56, 78, 65, 1, 5]

Replace element 12 with 11, and element 65 with 0.

Tarea

You have the following array: [12, 56, 78, 65, 1, 5].

You have to obtain the following arrays using the correct method: arr_1 = [11, 56, 78, 0, 1, 5] arr_2 = [12, 56, 78, 65, 1, 5]

Replace element 12 with 11, and element 65 with 0.

Cambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones

¿Todo estuvo claro?

Sección 4. Capítulo 5
toggle bottom row

Copying Arrays

It's worth noting that NumPy offers various methods for duplicating arrays. In this section, we'll explore one of these methods, namely: .copy().

Note

The .copy() method creates a new array with the data from the original one.

Using the .copy() method:

123456789
import numpy as np arr = np.array([7, 43, 56, 123, 10, 3]) x = arr.copy() arr[0] = 42 print(arr) print(x)
copy

Tarea

You have the following array: [12, 56, 78, 65, 1, 5].

You have to obtain the following arrays using the correct method: arr_1 = [11, 56, 78, 0, 1, 5] arr_2 = [12, 56, 78, 65, 1, 5]

Replace element 12 with 11, and element 65 with 0.

Tarea

You have the following array: [12, 56, 78, 65, 1, 5].

You have to obtain the following arrays using the correct method: arr_1 = [11, 56, 78, 0, 1, 5] arr_2 = [12, 56, 78, 65, 1, 5]

Replace element 12 with 11, and element 65 with 0.

Cambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones

¿Todo estuvo claro?

Sección 4. Capítulo 5
toggle bottom row

Copying Arrays

It's worth noting that NumPy offers various methods for duplicating arrays. In this section, we'll explore one of these methods, namely: .copy().

Note

The .copy() method creates a new array with the data from the original one.

Using the .copy() method:

123456789
import numpy as np arr = np.array([7, 43, 56, 123, 10, 3]) x = arr.copy() arr[0] = 42 print(arr) print(x)
copy

Tarea

You have the following array: [12, 56, 78, 65, 1, 5].

You have to obtain the following arrays using the correct method: arr_1 = [11, 56, 78, 0, 1, 5] arr_2 = [12, 56, 78, 65, 1, 5]

Replace element 12 with 11, and element 65 with 0.

Tarea

You have the following array: [12, 56, 78, 65, 1, 5].

You have to obtain the following arrays using the correct method: arr_1 = [11, 56, 78, 0, 1, 5] arr_2 = [12, 56, 78, 65, 1, 5]

Replace element 12 with 11, and element 65 with 0.

Cambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones

¿Todo estuvo claro?

It's worth noting that NumPy offers various methods for duplicating arrays. In this section, we'll explore one of these methods, namely: .copy().

Note

The .copy() method creates a new array with the data from the original one.

Using the .copy() method:

123456789
import numpy as np arr = np.array([7, 43, 56, 123, 10, 3]) x = arr.copy() arr[0] = 42 print(arr) print(x)
copy

Tarea

You have the following array: [12, 56, 78, 65, 1, 5].

You have to obtain the following arrays using the correct method: arr_1 = [11, 56, 78, 0, 1, 5] arr_2 = [12, 56, 78, 65, 1, 5]

Replace element 12 with 11, and element 65 with 0.

Cambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones
Sección 4. Capítulo 5
Cambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones
We're sorry to hear that something went wrong. What happened?
some-alt