What function is used to reshape a NumPy array?
Correct answer
A. reshape()
13 views
A. reshape()
13 views
reshape() gives an array a new shape without changing its data and returns the result: np.arange(6).reshape(2, 3). The total number of elements must stay the same.
resize() is different — it changes the array in place and may alter the number of elements.
Keep preparing with more Data Science MCQs on MCQsExam.com.
Not sure why the answer is A? Ask here and get an explanation.