numpy stack arrays vertically

Solutions on MaxInterview for numpy stack arrays vertically by the best coders in the world

showing results for - "numpy stack arrays vertically"
Arnaud
19 Jun 2020
1import numpy as np
2# ensure same shape of arrays to be stacked.
3a = np.arange(10).reshape(2,-1)
4b = np.repeat(1, 10).reshape(2,-1)
5# use vstack() to stack by row.
6out = np.vstack((a,b))
7## print output
8print(out)
9# a
10# b