I have an array, e.g. arr = [1, 2, 3, 4]
, and m = 3
. I want to make a matrix with m
rows, repeating that array. The output of the example would be
[[1, 2, 3, 4],
[1, 2, 3, 4],
[1, 2, 3, 4]]
How can I do this? I tried by
np.vstack((arr, arr, arr))
However, as I understood it, this only works if I effectively hardcore m
.