Created
February 15, 2019 18:32
-
-
Save Robofied/a7be0a3dbe427fcf6c46e29369633bcd to your computer and use it in GitHub Desktop.
Numpy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Creating a new array | |
c = np.array([11,12,13]) | |
## Creating another array using view function | |
d = c.view() | |
## Checking the value of "d" | |
print(d) | |
#[Output]: | |
#[11 12 13] | |
## Checking the id'd of both array | |
## In views id will be different for both the arrays. | |
print(id(c)) | |
print(id(d)) | |
#[Output]: | |
#2090543654432 | |
#2090543652992 | |
## See changes if value in any array is updated | |
## Assigning the new value in "d" | |
d[0] = 14 | |
print(d) | |
#[Output]: | |
#[14 12 13] | |
## Checking if changes is reflected in c or not. | |
print(c) | |
#[Output]: | |
#[14 12 13] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment