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 :
# 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 :
# 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.]]
Contact Us