I have one np array with 10 rows and 5 columns. I also have an array with 20 rows and a single column.
a = [[15,2,1,0,0],
[8,12,0,0,0],
[4,12,10,9,0],
[3,0,0,0,0],
[19,7,0,0,0],
[13,15,4,0,0],
[0,0,0,0,0],
[11,4,0,0,0],
[7,0,0,0,0,0],
[10,6,8,4,0]]
b = [8,1,6,4,9,3,5,6,11,14,5,4,33,7,9,15,7,3,19,3]
For array a, once a value in a row is zero, any value after that will be zero.
I would like to cycle through each row in a and find the nth value in b, and then store that in a 10x5 array called c. Any zero in a should also be a zero in c.
For example, the first two rows in c would be:
[[9,1,8,0,0],
[6,4,0,0,0]]
Thank you!