I have an array (b) and I want to add new rows according to the position of 1s in the (a) array.
a=np.array([1,1,0,1,0]
b=np.array([1,2,3,4,5])
I'd need to make a new array like this:
Output: array([1,2,3,4,5],[1,0,0,0,0],[0,1,0,0,0],[0,0,0,1,0])
How could this be done? Loop and append? Many thanks in advance