Stack Arrays as Rows

easynumpy_combine

Implement stack_rows(arrays).

Given a list of k equal-length 1D arrays, return a 2D array of shape (k, n) whose row i is arrays[i]. No for/while loops.

Constraints
  • no for/while loops

Your solution

Edit stack_rows 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.vstack(arrays) (or np.stack(arrays, axis=0)) stacks 1D arrays into the rows of a 2D array.