Course Content

# NumPy in a Nutshell

NumPy in a Nutshell

## Reshaping

Sometimes situations arise when we need to somehow change our array, for example, change the size of the array or go from an array of one dimension to an array of another dimension, but with the same data that was originally used. But it is not always convenient to recreate the array from scratch, so some functions modify the array as we need it. Let's look at some of them.

• `np.reshape()` - this function changes the shape of an N-dimensional array in such a way that the total number of elements remains the same.
• `np.transpose()` - this function transpose the array, that is it swaps the axis of the array.
• `np.concatenate()` - this function creates a new array, as follows: add arrays one after another, along the axis which is given by.
• `np.resize()` - this function is designed to resize an array. It creates a copy of the original array with the specified size.

Reshape one-dimensional array into a two-dimensional array.

Reshape one-dimansional into a three-dimensional array.

Consider the following array `[11, 56, 78, 45, 1, 5]`. You have to get such an array: `[[11, 56], [78, 45], [1, 5]]`.
Please, use `.reshape()` function.