Say when we have a randomly generated 2D 3x2 Numpy array a = np.array(3,2)
and I want to change the value of the element on the first row & column (i.e. a[0,0]) to 10. If I do
a[0][0] = 10
then it works and a[0,0] is changed to 10. But if I do
a[np.arange(1)][0] = 10
then nothing is changed. Why is this?
I want to change some columns values of a selected list of rows (that is indicated by a Numpy array) to some other values (like a[row_indices][:,0] = 10
) but it doesn't work as I'm passing in an array (or list) that indicates rows.