Kind of new to python and I need to use numpy to append a column, I have an ndarray a with [[1 2 3] [4 5 6]]
and another ndarray with b [1 7]
so the end result should be [[1 2 3 1] [4 5 6 7]
. I have tried
array = np.append(a , b, axis=1)
but I get
all the input arrays must have same number of dimensions
(makes sense). I was also trying to insert it in a for loop but based on what i have seen with python these libraries have an easy way to do things and I was wondering if there is a more efficient way?
question from:https://stackoverflow.com/questions/65947622/numpy-array-adding-a-column