Suppose you have a numpy array and a list:
>>> a = np.array([1,2,2,1]).reshape(2,2) >>> a array([[1, 2], [2, 1]]) >>> b = [
Read-only array in numpy can be made writable:
nArray.flags.writeable = True
This will then allow assignment operations like this one:
nArray[nArray == 10] = 9999 # replace all 10's with 9999's
The real problem was not assignment itself but the writable flag.