[Numpy-discussion] is there a better way to do this array repeat?

Chris Colbert sccolbert at gmail.com
Sun Aug 16 20:30:58 EDT 2009


great, thanks!

by order I meant repeat the array in order rather than repeat each element.



On 8/16/09, Stéfan van der Walt <stefan at sun.ac.za> wrote:
> 2009/8/16 Chris Colbert <sccolbert at gmail.com>:
>> 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.
>
> a = np.arange(3)[None, :]
> np.repeat(a, 10, axis=0)
>
> Regards
> Stéfan
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion at scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>



More information about the NumPy-Discussion mailing list