Open In App

numpy.matlib.zeros() function | Python

Last Updated : 22 Apr, 2020
Comments
Improve
Suggest changes
Like Article
Like
Report
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 : Python3
# 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)
Output :
[[ 0.  0.  0.]
 [ 0.  0.  0.]
 [ 0.  0.  0.]]
  Code #2 : Python3
# 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)
Output :
[[ 0.  0.  0.  0.]]

Next Article

Similar Reads