Write a NumPy program to create to concatenate two given arrays of shape (2, 2) and (2,1)
- برمجة بايثون
- 2021-09-13
- mhanasmh00489829403
الأجوبة
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. ]]
أسئلة مشابهة
القوائم الدراسية التي ينتمي لها السؤال