Course Content
NumPy in a Nutshell
1. Getting Started with NumPy
3. Indexing and Slicing
4. Important Functions
NumPy in a Nutshell
Joining
Another equally important function in working with arrays is array joining. Joining arrays means making one common array from several arrays, which will contain all the elements from each array. We concatenate arrays along the axes.
- If the
axis = 0
(this is the default value) then this means we concatenate the arrays by rows. - If the
axis = 1
then this means we concatenate the arrays by columns.
Join two arrays:
Join two 2-D arrays along columns (axis=1):
Join two 2-D arrays along rows (axis=0, as default):
Task
You have such arrays
[[12, 56, 78], [35, 1, 5]]
[[8, 65, 3], [1, 2, 3]]
You have to get such an array:[[12 56 78 8 65 3] [35 1 5 1 2 3]]
.
Everything was clear?
Section 4. Chapter 3