Sitemap

Concatenation in Numpy

3 min readJul 28, 2025

--

print("Welcome to world of Numpy 💛")

Have you thought about how to concatenate Numpy’s arrays? Or you haven’t got any clue! Don’t worry I am here to help you with it 😃.

Concatenation

Before we dive into how to concatenate Arrays using numpy, lets review how we do it normally.

Press enter or click to view image in full size

Initially we created two arrays, and assigned them integer values.

Press enter or click to view image in full size
First way of concatenation
Press enter or click to view image in full size
Second way of concatenation

Then we created a new array and assign those arrays to it.

Press enter or click to view image in full size
Concatenated list

That’s how the concatenated list looks as an output.

Let’s see how can we concatenate using Numpy Library!

Press enter or click to view image in full size
Numpy array’s

At the beginning we imported Numpy library, and then created two arrays .

Press enter or click to view image in full size
concatenate function

Then we concatenate both array’s using method provided by numpy library “concatenate” and passed the array’s name as Arguments.

Press enter or click to view image in full size
output

Finally arrays are concatenated. But Wait ! Isn’t it too easy?

Indeed it is!

Get Mian’s stories in your inbox

Join Medium for free to get updates from this writer.

Let’s try doing one more time.

Press enter or click to view image in full size
concat function

Here we created two dimensional numpy arrays and then called function concatenate. Wait till you see the output 😃.

Press enter or click to view image in full size
output

Did you see the magic?

Let me elaborate …

Numpy’s concat function, concatenated two array’s such that array passed as first argument to the function lies on the top of array passed as second array!

That’s how easy it was to concatenate arrays using Numpy.

print("Don't forget to explore it at your own! Good Luck 😉")

--

--

Mian
Mian

Written by Mian

Self Motivated, Naive Programmer.