import numpy as np
x = np.array([1, 2, 3])
y = np.array([2, 3, 4])
print("Original arrays:")
print(x)
print(y)
print("Sequence of arrays along a new axis:")
print(np.vstack((x, y)))
x = np.array([[1], [2], [3]])
y = np.array([[2], [3], [4]])
print("\nOriginal arrays:")
print(x)
print()
print(y)
print("Sequence of arrays along a new axis:")
print(np.vstack((x, y)))
Sample Output:
Original arrays:
[1 2 3]
[2 3 4]
Sequence of arrays along a new axis:
[[1 2 3]
[2 3 4]]
Original arrays:
[[1]
[2]
[3]]
[[2]
[3]
[4]]
Sequence of arrays along a new axis:
[[1]
[2]
[3]
[2]
[3]
[4]]
Sample Output:
need an explanation for this answer? contact us directly to get an explanation for this answer