numpy stack matrix code example Example: np.stack >>> np.stack((a, b), axis=-1) array([[1, 2], [2, 3], [3, 4]])