1. Home
  2. Data Science
  3. NumPy
  4. What is the purpose of the np.concatenate() function?

Added 24 Feb 2024

What is the purpose of the np.concatenate() function?

  1. To split an array into multiple sub-arrays
  2. To join arrays along an existing axis Correct answer
  3. To create an array with evenly spaced values
  4. To find the intersection of two arrays

Correct answer

B. To join arrays along an existing axis

16 views

MCQSEXAM

Explanation

np.concatenate() joins a sequence of arrays along an existing axis: np.concatenate((a, b), axis=0). The arrays must match in shape except along that axis.

Splitting is done with np.split(), and evenly spaced values come from np.linspace().

Want more practice? Try the full set of Data Science MCQs on MCQsExam.com.

Doubts & discussion

Not sure why the answer is B? 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