I have two arrays in Python (numpy arrays):
a=array([5,7,3,5])
b=array([1,2,3,4])
and I wish to create a third array with each element from b appearing a times in the new array, as:
c=array([1,1,1,1,1,2,2,2,2,2,2,2,3,3,3,4,4,4,4,4])
Is there a fast, numPythonic way of doing this with a minimum of looping? I need to use this operation thousands of times in a loop over a fairly large array, so I would like to have it be as fast as possible.
Cheers, Mike