A = np.zeros(shape = (3,4))
A = [[0 0 0 0]
[0 0 0 0]
[0 0 0 0]]
B = np.asarray[[2],[0],[3]]
Without a for loop, is there a simple way to change the value of the a components in A (to 1 for example), given the index in B
Such that:
A = [[0 0 1 0]
[1 0 0 0]
[0 0 0 1]]
I have been able to get this output with a for loop but would prefer it if it didn't for scalability in higher dimensional arrays.