I have an array of numbers, a. I have a second array, b, specifying how many times I want to retrieve the corresponding element in a. How
a
b
here's one way to do it:
res = [] for i in xrange(len(b)): for j in xrange(b[i]): out.append(a[i]) res = np.array(res) # optional