I am trying the following:
rands = np.empty((0, 10))
rand = np.random.normal(1, 0.1, 10)
rands = np.concatenate((rands,rand),axis=0)
which gives me the following error:
ValueError: all the input arrays must have same number of dimensions
But why is this error? Why can't I append a new row rand into the matrix rands with this command?
Remark:
I can 'fix' this by using the following command:
rands = np.concatenate((rands,rand.reshape(1, 10)),axis=0)
but it looks not pythonic anymore, but cumbersome...
Maybe there is a better solution with less brackets and reshaping...?
randshas initially an empty row it is still 2 dimensional the shape is(0,10)which is why it borksrands = np.empty((1, 10))rands = np.empty((1,10))rands = np.concatenate((rands[0],rand),axis=0)