Stack Arrays as Columns

easynumpy_combine

Implement stack_columns(arrays).

Given a list of k equal-length 1D arrays, return a 2D array of shape (n, k) whose column j is arrays[j] — i.e. assemble the arrays as the columns of a matrix (a design / feature matrix). No for/while loops.

Constraints
  • no for/while loops

Your solution

Edit stack_columns 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

np.column_stack(arrays) places each 1D array as a column of the result.