Concatenating empty array in Numpy
if you know the number of columns before hand:
>>> xs = np.array([[1,2,3,4,5],[10,20,30,40,50]])
>>> ys = np.array([], dtype=np.int64).reshape(0,5)
>>> ys
array([], shape=(0, 5), dtype=int64)
>>> np.vstack([ys, xs])
array([[ 1., 2., 3., 4., 5.],
[ 10., 20., 30., 40., 50.]])
if not:
>>> ys = np.array([])
>>> ys = np.vstack([ys, xs]) if ys.size else xs
array([[ 1, 2, 3, 4, 5],
[10, 20, 30, 40, 50]])
If you wanna do this just because you cannot concatenate an array with an initialized empty array in a loop, then just use a conditional statement, e.g.
if (i == 0):
do the first assignment
else:
start your contactenate