numpy.resize() in Python

The numpy.resize() returns a new array with the specified shape. If the new array is larger than the original array, then the new array is filled with repeated copies of a. 



The numpy.resize() parameter consists of two parameters, which are as follows:

a : This parameter represents the array to be resized.

new_shape: This parameter represents the shape of the resized array.


This function returns the new array that is formed from the data in the old array, repeated if necessary to fill out the required number of elements. The data are repeated in the order that they are stored in memory.

Example 1


Example 2


Pin It on Pinterest

Share This