I have two arrays A1(5,3)
and A2(5,2)
and want to create a new array A(5,5)
. I've try to use A=np.concatenate((A1,A2))
but it gives me the error
all the input array dimensions for the concatenation axis must match exactly, but along dimension 1, the array at index 0 has size 3 and the array at index 1 has size 2
How can I solve this?
CodePudding user response:
To use np.concatenate
you should specify on which axis the concatenation is happening. In this case, you should use:
A = np.concatenate((A1, A2), axis=1)
Other way to solve this issue is to use horizontal stack:
A = np.hstack((A1, A2))