# Numpy: How to permute array into indices of larger array? [closed]

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?

## closed as off-topic by Bill Greene, Christian Clason, Kirill, nicoguaro♦Dec 4 '18 at 23:32

This question appears to be off-topic. The users who voted to close gave this specific reason:

If this question can be reworded to fit the rules in the help center, please edit the question.

L[L==0]=N