Return 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 copied of a. Note that this behavior is different from a.resize(new_shape) which fills with zeros instead of repeated copies of a.
Parameters: | a : array_like
new_shape : {tuple, int}
|
---|---|
Returns: | reshaped_array : ndarray
|
See also
Examples
>>> a=np.array([[0,1],[2,3]])
>>> np.resize(a,(1,4))
array([[0, 1, 2, 3]])
>>> np.resize(a,(2,4))
array([[0, 1, 2, 3],
[0, 1, 2, 3]])