I am using python2.7 and numpy and I have the following matrix:
L = np.asmatrix([[0,1,2,3,4], [5,6,7,8,9]])
and I am trying to swap L[[0,1], 0] with L[[1,0], 0] but I have the error:
"shape mismatch: value array of shape (2,1) could not be broadcast to indexing result of shape (2,)"
I cannot understand this because if I print L[[0,1], 0] and L[[1,0], 0] they return
L[[0,1], 0] = matrix([[0]
[5]])
L[[1,0], 0] = matrix([[5]
[0]])
Anyway if I swap the entire row with L[[0,1], :] = L[[1,0], :] it works perfect but it isn't what I want to do.
Do you have any suggestion?