Quickest way to insert zeros into numpy array
u can use np.zeros and append it to your existing array like
newid=np.append(np.zeros((4,), dtype=int),ids)
Good Luck!
I have a numpy array ids = np.array([1,1,1,1,2,2,2,3,4,4])
and another array of equal length vals = np.array([1,2,3,4,5,6,7,8,9,10])
Note: the ids array is sorted by ascending order
I would like to insert 4 zeros before the beginning of each new id - i.e. 
new array = np.array([0,0,0,0,1,2,3,4,0,0,0,0,5,6,7,0,0,0,0,8,0,0,0,0,9,10])
Only, way I am able to produce this is by iterating through the array which is very slow - and I am not quite sure how to do this using insert, pad, or expand_dim ...