NumPy TutorialLesson 12Free preview
NumPy Array Join
This lesson is part of NumPy · All levels
Summary
An array merger is done with np.concatenate that connects data on a particular axis. np.stack is different: it creates a new dimension of flat arrays. Also available are vstack aliases for vertical joining and hstack for horizontal, so that the selection of functions follows the desired orientation.
Key points
- Np.concatenate connects arrays to an existing (default axis 0).
- Np.stack creates a new dimension, suitable for an array of the same shape.
- Vstack combines down, hstack combines to the side.
- All arrays combined must fit in dimensions other than the axis of the merger.
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.