-1

I have two numpy arrays that have the same shape(4,1,2). How can I combine them and get a new array of size(8,1,2) with minimum lines of python code? Not changing values just put them together with A on the top B at the bottom.

    A=numpy.array([[[1,1]],
                   [[2,2]],
                   [[3,3]],
                   [[4,4]]]);


   B=numpy.array([[[5,5]],
                   [[6,6]],
                   [[7,7]],
                   [[8,8]]]);
1

2 Answers 2

2

numpy.concatenate() should do what you want:

numpy.concatenate((A, B))
Sign up to request clarification or add additional context in comments.

1 Comment

numpy.vstack((A,B)) is another alternative
0

Use numpy.vstack()

numpy.vstack([A,B])

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.