I don't think np.repeat will do what I want because the order needs to
be preserved.

I have a 1x3 array that I want to repeat n times and form an nx3 array
where each row is a copy of the original array.

So far I have this:

>>> import numpy as np
>>> a = np.arange(3)
>>> b = np.asarray([a]*10)
>>> b
array([[0, 1, 2],
       [0, 1, 2],
       [0, 1, 2],
       [0, 1, 2],
       [0, 1, 2],
       [0, 1, 2],
       [0, 1, 2],
       [0, 1, 2],
       [0, 1, 2],
       [0, 1, 2]])
>>> b.shape
(10, 3)


the issue is that my n may be very large and I'd rather not make that
list if I don't have to.


Cheers,

Chris
_______________________________________________
NumPy-Discussion mailing list
[email protected]
http://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to