numpy.column_stack() function is used to stack 1-D arrays as columns into a 2-D array.It takes 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
Syntax : numpy.column_stack(tup)
tup : [sequence of ndarrays] Tuple containing arrays to be stacked. The arrays must have the same first dimension.
Return : [stacked 2-D array] The stacked 2-D array of the input arrays.
Code #1 :
1st Input array : [1 2 3] 2nd Input array : [4 5 6] Output stacked array: [[1 4] [2 5] [3 6]]
Code #2 :
1st Input array : [[ 1 2 3] [-1 -2 -3]] 2nd Input array : [[ 4 5 6] [-4 -5 -6]] Output stacked array : [[ 1 2 3 4 5 6] [-1 -2 -3 -4 -5 -6]]
- Reusable piece of python functionality for wrapping arbitrary blocks of code : Python Context Managers
- Python - Read blob object in python using wand library
- Python | Convert list to Python array
- twitter-text-python (ttp) module - Python
- Python | Merge Python key values to list
- Important differences between Python 2.x and Python 3.x with examples
- MySQL-Connector-Python module in Python
- Python | PRAW - Python Reddit API Wrapper
- Reading Python File-Like Objects from C | Python
- Python | Index of Non-Zero elements in Python list
- Python | Set 4 (Dictionary, Keywords in Python)
- Python | Add Logging to Python Libraries
- Python | Add Logging to a Python Script
- Python | Sort Python Dictionaries by Key or Value
- Python | Visualizing O(n) using Python
- bin() in Python
- chr() in Python
- Python Set | pop()
- gcd() in Python
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.