I have three numpy arrays:
Arr1 = [9,7,3,1] (1 x 4 array)
Arr2 = [[14,6],[13,2]] (2 x 2 array)
Arr3 = [0,2] (1 x 2 array)
I need to replace the elements in Arr1 with the elements in Arr2 with the corresponding indices given in Arr3, such that the output would be:
Output_Arr = [[14,6],[7],[13,2],[1]]
I've written some code that I think is a good start, but it's not working. No errors or anything, just the Arr1 is not updating as if the criteria is not satisfied:
dim1 = len(Arr1)
dim2 = len(Arr2)
dim3 = len(Arr3)
for i in range(dim1):
for j in range(dim3):
if i==Arr3[j]:
Arr1[i] = Arr2[j]
else:
Arr1[i] = Arr1[i]
Does anyone have any ideas of how to go about this?