NumPy Basics - Reshaping and Concatenation

5. Reshaping of Arrays

Reshaping is about changing the way items are arranged within the array so that the shape of the array changes, but the total number of elements in both arrays remains the same, e.g., you can use it to convert a 1D array into 2D array.

Reshaping is a very useful operation and it can easily be done using the reshape() method. Since a picture speaks a thousand words, let’s see the effects of reshaping visually:

Get hands-on with 1200+ tech skills courses.