I have a 3x2x2 numpy array and I want to join another array to it that is 3x2 so that my new array is then 3x2x3. I have been trying with stack and concatenate but I keep getting ValueError: all input arrays must have the same shape. The existing array is like follows
array([[[1, 1],
[2, 2]],
[[3, 3],
[4, 4]],
[[5, 5],
[6, 6]]])
And I wish to join another array that is like so:
array([[1, 2],
[3, 4],
[5, 6]])
The output would be like so:
array([[[1., 1., 1.],
[2., 2., 2.]],
[[3., 3., 3.],
[4., 4., 4.]],
[[5., 5., 5.],
[6., 6., 6.]]])
I am not sure if I have written the output correctly as the way numpy displays matrices with 3 dimnsions confuses me- The result should have the shape(3,2,3). I wish to do this iteratively so that I can keep extending the matrix so that the shape would be (3,2,4) then (3,2,5) then (3,2,6) etc...
stackerror message, butconcatenatecomplainedall the input arrays must have same number of dimensions. Right? Do you know how to correct that? How to add a dimension to the (3,2) array?concatenate?