What does the np.ravel() function in NumPy do?
Correct answer
A. Flattens a multi-dimensional array into a 1D array
15 views
A. Flattens a multi-dimensional array into a 1D array
15 views
np.ravel() flattens a multi-dimensional array into a 1-D array. It returns a view of the original data whenever possible, so it is memory-efficient.
flatten() does the same job but always returns a copy.
For more solved questions like this one, see Data Science MCQs on MCQsExam.com.
Not sure why the answer is A? Ask here and get an explanation.