Created
February 15, 2019 18:34
-
-
Save Robofied/b1b83ff8a78b8626ca0d86e65a341873 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. | |
e = np.array([21,22,23]) | |
## Creating a new array by using copy function. | |
f = e.copy() | |
## Checking the ids of both arrays | |
#3 In this case also both will have different idsIn [13]: | |
print(id(e)) | |
print(id(f)) | |
#[Output]: | |
#2090543656512 | |
#2090543655152 | |
## See changes if value in any array is updated | |
## Assigning the new value to e | |
e[0] =24 | |
##Priting to check the updated array. | |
print(e) | |
#[Output]: | |
#[24 22 23] | |
## Printing to check if the another array created using copy(), will be change or not? | |
## In this case it will not reflect the changes. | |
print(f) | |
#[Output]: | |
#[21 22 23] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment