We said a simple array,
1 | import numpy as np |
Copy
Normally, we set b is equal to a and c is equal to b.
1 | b = a |
When we change a value in array a
1 | a[0] = 99 |
Will the array of b be changed? And c?
1 | array([99, 1, 2, 3]) |
They all changed like above. So we are sure they have a link in each other, if we change any value of them, they all will be changed.
Deep Copy
In numpy, we have a inner function to copy and there is no any link between.
1 | d = a.copy() |
However we change the value of a, d will not change anything.
Thanks for your reading, I hope it is useful for you.
End
Illustrator / Cagy
Text / Cagy
Editor / Cagy
Design / Cagy