I have two arrays and one list with indices
Array source (array 01):
x = np.array([[1,2,3], [4,5,6], [7,8,9]])
array([[1, 2, 3],
[4, 5, 6],
[7, 8, 9]])
Array with new values (array 02):
y = np.array([11, 22, 33])
array([11, 22, 33])
and a list with indices
a = [1,2,1]
[1, 2, 1]
I need to replace the values of array 02 in array 01 based on indices
The return expected:
array([[1, 11, 3],
[4, 5, 22],
[7, 33, 9]])
How to do this without loop?
Thanks in advance.
numpytag also discusses quite a similar question