Write a NumPy program to create to concatenate two given arrays of shape (2, 2) and (2,1).
import numpy as np nums1 = np.array([[4.5, 3.5], [5.1, 2.3]]) nums2 = np.array([[1], [2]]) print("Original arrays:") print(nums1) print(nums2) print("\nConcatenating the said two arrays:") print(np.concatenate((nums1, nums2), axis=1))
Sample Output:
Original arrays: [[4.5 3.5] [5.1 2.3]] [[1] [2]] Concatenating the said two arrays: [[4.5 3.5 1. ] [5.1 2.3 2. ]]
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