In NumPy, How can I append a new array to an existing one?

Hi there! I’m not sure how to do this and I can’t find it at the moment. How can I append a new array to an existing one?

my_array = np.array([1, 2, 3, 4, 5, 6])
second_array = np.array([100, 99, 98, 97, 96, 95])
third_array = ?????????

How can I join the first array with the second one and create an “third_array”?

You’re using append, and join. These terms won’t help a lot in finding what you’re looking for.

I’ll pass on two keywords that will help you find a valid result.


Concatenation result would be:


If you want to get something like:
[my_array, second_array]
for a result that would be a merge.

For the merge, you need to make sure the array dimensions are aligned first then sort them afterwards by using some “kind” of “merge” keyword.

Hope this helps, I’ve not actually used numpy before so it’s the best I could come up with :confused:

Hey! Thanks for the help. I used the keywords you mentioned and I got good results. Apparently the following, with their respective parameters, are the way you can concatenate an array to another array.

1 Like