I have an array of length L with N zeros, and L-N non-zero values. I have another array of length N. I would like to put the values of the shorter array into the positions of the longer array which are zero, keeping them in order. For example, if I had,
$$ L = \, [1,2,3,0,0,4,5,6,0] $$ $$ N = \, [10,0,20] $$ I would want, $$ L' = \, [1,2,3,10,0,4,5,6,20] $$ I will do this repeatedly with the same $L$ and many different $N$ (all of the same length). What is the best way to accomplish this using Numpy?