NumPy Array manipulation: column_stack() function
Stack 1-D arrays as columns into a 2-D array.
Take a sequence of 1-D arrays and stack them as columns to make a single 2-D array. 2-D arrays are stacked as-is, just like with hstack. 1-D arrays are turned into 2-D columns first.
|tup||Arrays to stack. All of them must have the same first dimension.||Required|
stacked : 2-D array The array formed by stacking the given arrays.
>>> import numpy as np >>> x = np.array((3,4,5)) >>> y = np.array((4,5,6)) >>> np.column_stack((x,y)) array([[3, 4], [4, 5], [5, 6]])
Python - NumPy Code Editor:
- New Content published on w3resource:
- Scala Programming Exercises, Practice, Solution
- Python Itertools exercises
- Python Numpy exercises
- Python GeoPy Package exercises
- Python Pandas exercises
- Python nltk exercises
- Python BeautifulSoup exercises
- Form Template
- Composer - PHP Package Manager
- PHPUnit - PHP Testing
- Laravel - PHP Framework