I have a problem with array manipulation in NumPy. If I create two arrays x and y, and do
x = x - y
I get what I expect, that is each element of y is subtracted from the corresponding element of x, and thus x is modified.
However, if I put this in a loop:
m = np.array([[1,2,3],[1,2,3]])
y = array([1, 1, 1])
for i in m:
i = i - y
the matrix m remains unaltered. I am sure I am missing something very basic... How can I change the array m in a loop?