educative.io

Does Numpy Reshape Retain Dimension Count?

Reshaping is about changing the way items are arranged within the array so that the shape of the array changes but the overall number of dimensions stays the same, e.g., you can use it to convert a 1D array into 2D array.

Doesn’t the number of dimensions change in the example provided? i.e. a one-dimensional array to a two-dimensional array

Hi @Xavi
Thanks for contacting the Educative team. In python, reshaping an array means changing either the number of elements in an array or changing the dimension of the array, or both. So the number of dimensions will change when we reshape the 1D array into a 2D array.
We have updated the lesson.
Inconvenience is regretted. Happy Learning :blush:

1 Like