Let's say I have NumPy array with indexes:
array([[1, 3],
[2, 5]])
Also, I have NumPy array with zeros:
array([[0., 0., 0., 0., 0., 0.],
[0., 0., 0., 0., 0., 0.]])
I need to take the first row from the array with indexes and set 1 for these indexes in the first row of the array with zeros. After this first row must look like [0, 1, 0, 1, 0, 0].
Then I need to do also for the second row in the array with zeros and use the second row from the array with indexes respectively. After this second row must look like [0, 0, 1, 0, 0, 1].
So, I want to get array like this:
array([[0, 1, 0, 1, 0, 0],
[0, 0, 1, 0, 0, 1]])
How can I do this without any loop?