This is a pre-release version (latest). Go to latest (2.4.4)
{ } Raw JSON

bundles / numpy latest / numpy / ma / extras / column_stack

function

numpy.ma.extras:column_stack

source: build-install/usr/lib/python3.14/site-packages/numpy/lib/_shape_base_impl.py :625

Signature

def   column_stack ( tup )

Summary

Stack 1-D arrays as columns into a 2-D array.

Extended Summary

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.

Parameters

tup : sequence of 1-D or 2-D arrays.

Arrays to stack. All of them must have the same first dimension.

Returns

stacked : 2-D array

The array formed by stacking the given arrays.

Notes

The function is applied to both the _data and the _mask, if any.

Examples

import numpy as np
a = np.array((1,2,3))
b = np.array((4,5,6))
np.column_stack((a,b))

See also

concatenate
hstack
stack
vstack

Aliases

  • numpy.ma.column_stack