How to concatenate two arrays in NumPy

You can concatenate two arrays in NumPy with the following code. If you want to learn Python, I highly recommend reading This Book.

How to concatenate two arrays in NumPy
How to concatenate two arrays in NumPy

Example 1

In this example, I will concatenate two arrays row-wise.

Python

Output:

[[  5  10]
 [ 15  20]
 [100 200]]

Example 2

In this example, I will concatenate two arrays column-wise.

Python

Output:

[[  5  10 100]
 [ 15  20 200]]

Example 3

Python

Output:

[  5  10  15  20 100 200]

Free Learning Resources

Leave a Comment

Your email address will not be published.