1. Home
  2. Data Science
  3. NumPy
  4. What does the np.vstack() function do in NumPy?

Added 24 Feb 2024

What does the np.vstack() function do in NumPy?

  1. Stacks arrays vertically Correct answer
  2. Stacks arrays horizontally
  3. Splits an array into multiple sub-arrays vertically
  4. Splits an array into multiple sub-arrays horizontally

Correct answer

A. Stacks arrays vertically

16 views

MCQSEXAM

Explanation

np.vstack() stacks arrays vertically, i.e. row-wise, one on top of another. Two arrays of shape (3,) become one array of shape (2, 3).

np.hstack() stacks horizontally, column-wise.

Keep preparing with more Data Science MCQs on MCQsExam.com.

Doubts & discussion

Not sure why the answer is A? Ask here and get an explanation.

Ask a doubt about this MCQ

Shown after review. No links please.

More NumPy MCQs

Practise all NumPy MCQs

Similar MCQs