Append n copies of an array at the end of a numpy array

append, arrays, numpy, python

Solution

It appears you want to use `tile()`

C = np.concatenate((A, np.tile(B,n)))

Problem

Let A and B be two `numpy` arrays. I want to append `n` copies of `B` at the end of `A` : ``` C = [A, B, B, B, ... (n times) ... B, B] ``` How to do this simply/efficiently with `numpy` ? Something like ``` numpy.append(A, [B * n]) # B * n is not n copies of B, # but rather B multiplied by constant n ? ``` or with `numpy.concatenate` ?

Original source