Write a NumPy program to stack 1-D arrays as row wise.
import numpy as np print("\nOriginal arrays:") x = np.array((1,2,3)) y = np.array((2,3,4)) print("Array-1") print(x) print("Array-2") print(y) new_array = np.row_stack((x, y)) print("\nStack 1-D arrays as rows wise:") print(new_array)
Sample Output:
Original arrays: Array-1 [1 2 3] Array-2 [2 3 4] Stack 1-D arrays as rows wise: [[1 2 3] [2 3 4]]
total answers (1)
start bookmarking useful questions and collections and save it into your own study-lists, login now to start creating your own collections.
Sample Output:
need an explanation for this answer? contact us directly to get an explanation for this answer