Curriculum
Course: NumPy
Login

Curriculum

NumPy

Text lesson

VIEW

Example

Create a view of the array, modify the original array, and then display both arrays.

import numpy as np

arr = np.array([12345])
x = arr.view()
arr[0] = 42

print(arr)
print(x)
The view should be impacted by any changes made to the original array.

Make Changes in the VIEW:

Example

Create a view of the array, modify the view, and then display both arrays.

import numpy as np

arr = np.array([12345])
x = arr.view()
x[0] = 31

print(arr)
print(x)