column

column(x, index)

Try it yourself:

See also:
row

column(): extract a matrix column

column(value, index) selects one column from a matrix or two-dimensional array. It is a convenient way to isolate a variable, feature, or coordinate without manually copying each row.

Example

Given [[10, 20], [30, 40], [50, 60]], selecting the appropriate column index returns the vertical series 20, 40, 60. Check the calculator’s indexing convention carefully—many mathematical APIs use zero-based indexes, so the first column is index 0.

Use in data preparation

Extract a column before computing mean(), variance(), or sum(). Pair it with row() for row selection, and use matrixFromColumns() to assemble columns again. clone() is useful before editing extracted data.

Bounds and shape

The input must have rows and the index must refer to an existing column. Ragged arrays and out-of-range indexes can give errors or inconsistent shapes; validate dimensions first with size().

Try Column in Calcul.io

Start with one of the editable examples above, then replace its arguments with your own values. Keeping the function on a separate calculator line makes the input and result easy to compare. For a longer workflow, assign the result to a variable or reference that line in the next expression.

Check the shown signature before adding optional arguments, and use the related-function links to compare operations with similar purposes.

All functions