Equivalent of numpy.repeat

Hi,
I found some comments on the matter online but nothing that would repeat elekemtn of a list based on a count given by a list like:

import numpy as np

x = np.array([1, 2])
print np.repeat(x, [2, 3], axis=0)

I would like a results to be like

[1, 1, 2, 2, 2]

I tried the repeat function but it doesn’t seem to work.

Thanks

See here:

2 Likes

Great - exactly what I needed!