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

Citi, Luca lciti@essex.ac...
Mon Aug 17 04:24:48 CDT 2009


As you stress on "repeat the array ... rather than repeat each element",
you may want to consider tile as well:

>>> np.tile(a, [10,1])
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]])



More information about the NumPy-Discussion mailing list