Column Vector

easynumpy_basics

Implement to_column(x).

Given a 1D array x of length n, return it as a 2D column vector of shape (n, 1). Remember that x.T leaves a 1D array unchanged — you need to add a new axis (e.g. reshape(-1, 1) or x[:, None]). No for/while loops.

Constraints
  • no for/while loops

Your solution

Edit to_column and run the real pytest suite in your browser — no install required. Your code is saved locally.

⌘/Ctrl + ↵

Loading the Python runtime (first run only)…

Hints

Hint 1

Transposing a 1D array does nothing; add an axis instead: x.reshape(-1, 1) or x[:, None].