Suppose a 2d numpy array as the following:
A = np.ones((5,5))
Now, I want to update (change) all the values of A using the following code:
for row in A:
for entry in row:
entry = 999
After this, the entries en A are 1, i.e. the matrix is the same as the original.
But, If I run this code, the values are changed:
for i,row in enumerate(A):
for j,entry in enumerate(row):
A[i][j] = 999
Why this is happening?
Is the cell
variable a copy and not a pointer?