numpy.matlib.zeros() function | Python

numpy.matlib.zeros() function return matrix of given shape and type, filled with zeros.

Syntax : numpy.matlib.zeros(shape, dtype = None, order = ‘C’)
Parameters :
shape : [sequence of ints] Shape of the empty matrix.
dtype : [data-type, optional] The desired data-type for the matrix, default is float.
order : [{‘C’, ‘F’}, optional] Whether to store the result in C- or Fortran-contiguous order, default is ‘C’.
Return : [matrix] Zero matrix of given shape, dtype, and order.

Code #1 :

filter_none

edit
close

play_arrow

link
brightness_4
code

# Python program explaining
# numpy.matlib.zeros() function
  
# importing numpy as geek 
# and importing matlib module  
import numpy as geek
import numpy.matlib
  
gfg = geek.matlib.zeros((3, 3))
  
print (gfg)

chevron_right


Output :

[[ 0.  0.  0.]
 [ 0.  0.  0.]
 [ 0.  0.  0.]]

 
Code #2 :

filter_none

edit
close

play_arrow

link
brightness_4
code

# Python program explaining
# numpy.matlib.zeros() function
  
# importing numpy as geek 
# and importing matlib module  
import numpy as geek
import numpy.matlib
  
gfg = geek.matlib.zeros(4)
  
print (gfg)

chevron_right


Output :

[[ 0.  0.  0.  0.]]
My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.