Open In App

numpy.ndarray.resize() function - Python

Last Updated : 24 Sep, 2024
Comments
Improve
Suggest changes
Like Article
Like
Report

numpy.ndarray.resize() function change shape and size of array in-place.

Syntax : numpy.ndarray.resize(new_shape, refcheck = True)
Parameters :
new_shape :[tuple of ints, or n ints] Shape of resized array.
refcheck :[bool, optional] If False, reference count will not be checked. Default is True.

Return : None

Code #1 :

Python
# Python program explaining
# numpy.ndarray.resize() function
      
# importing numpy as geek 
import numpy as geek 
  
arr = geek.array([[0, 1], [2, 3]])

# this function change the shape and size
# of the array & return None
gfg = arr.resize((2, 1))

print (gfg)

Output :

None

Code #2 :

Python
# Python program explaining
# numpy.ndarray.resize() function
      
# importing numpy as geek 
import numpy as geek 
  
arr = geek.array([[0, 1], [2, 3]], order = 'F')

# this function change the shape and size
# of the array & return None
gfg = arr.resize((2, 1))
 
print (gfg)

Output :

None

Next Article
Practice Tags :

Similar Reads

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy