Skip to content
Related Articles
Get the best out of our app
GeeksforGeeks App
Open App
geeksforgeeks
Browser
Continue

Related Articles

numpy.ndarray.resize() function – Python

Improve Article
Save Article
Like Article
Improve Article
Save Article
Like Article

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 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 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
My Personal Notes arrow_drop_up
Last Updated : 11 Jun, 2020
Like Article
Save Article
Similar Reads
Related Tutorials