Python NumPy: Convert 1-D arrays as columns into a 2-D array
Python NumPy: Array Object Exercise-59 with Solution
Write a Python program to convert 1-D arrays as columns into a 2-D array.
Sample array: (10,20,30), (40,50,60)
import numpy as np a = np.array((10,20,30)) b = np.array((40,50,60)) c = np.column_stack((a, b)) print(c)
[[10 40] [20 50] [30 60]]
Python Code Editor:
Improve this sample solution and post your code through Disqus