Q:

Write a NumPy program to convert (in sequence depth wise (along third axis)) two 1-D arrays into a 2-D array. Sample array: (10,20,30), (40,50,60)

0

Write a NumPy program to convert (in sequence depth wise (along third axis)) two 1-D arrays into a 2-D array.
Sample array: (10,20,30), (40,50,60)

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

import numpy as np
a = np.array([[10],[20],[30]])
b = np.array([[40],[50],[60]])
c = np.dstack((a, b))
print(c)

Sample Output:

[[[10 40]]                                                             
                                                                       
 [[20 50]]                                                             
                                                                       
 [[30 60]]]

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now