Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Joining | Important Functions
NumPy in a Nutshell

Joining Joining

Another equally important operation in array manipulation is joining arrays. Joining arrays involves combining multiple arrays into a single array that includes all the elements from each of the original arrays.

We perform this concatenation along the specified axes:

  • if axis = 0 (which is the default value), this implies concatenating the arrays by rows;
  • if axis = 1, this means concatenating the arrays by columns.

Join two arrays:

Concatenate two 2-D arrays along columns (axis=1):

Concatenate two 2-D arrays along rows (default axis=0):

Task

You have two arrays:

  1. [[12, 56, 78], [35, 1, 5]];
  2. [[ 8, 65, 3], [ 1, 2, 3]].

You have to create the following combined array:

Everything was clear?

Section 4. Chapter 3
toggle bottom row
course content

Course Content

NumPy in a Nutshell

Joining Joining

Another equally important operation in array manipulation is joining arrays. Joining arrays involves combining multiple arrays into a single array that includes all the elements from each of the original arrays.

We perform this concatenation along the specified axes:

  • if axis = 0 (which is the default value), this implies concatenating the arrays by rows;
  • if axis = 1, this means concatenating the arrays by columns.

Join two arrays:

Concatenate two 2-D arrays along columns (axis=1):

Concatenate two 2-D arrays along rows (default axis=0):

Task

You have two arrays:

  1. [[12, 56, 78], [35, 1, 5]];
  2. [[ 8, 65, 3], [ 1, 2, 3]].

You have to create the following combined array:

Everything was clear?

Section 4. Chapter 3
toggle bottom row
some-alt