2

I have two 2D numpy arrays and I want to add one to the end of other.

Example:

`

My arrays are a & b:
a = [[ 1 , 2],
     [ 2 , 4],
     [ 6 , 8]]
b = [[ 3 , 5],
     [ 7 , 4]]
The result will be:
C = [[ 1 , 2],
     [ 2 , 4],
     [ 6 , 8],
     [ 3 , 5],
     [ 7 , 4]]

`

1

1 Answer 1

2

You can use np.concatenate():

c = np.concatenate((a, b), axis=0)
Sign up to request clarification or add additional context in comments.

2 Comments

note: this returns a ndarray, so cast back to a list if that isn't wanted
I am happy to help :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.