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([[ … Read more