Close
Close

what is mean by w=np.zeros((1,3) ?

   DHIRAJPATLE


Answers

  •   

    np.zeros() returns an array of a given shape filled with zeros. (Note that we are importing numpy as np)

    Therefore, np.zeros((1,3)) returns a 1x3 matrix filled with zeros. The default datatype of the filled values in the matrix and hence the matrix is numpy.float64.

    Take the following example.

    import numpy as np
    
    w = np.zeros((1,3))
    print(w)
    

    This will give the following output.

    array([[0., 0., 0.]])


Ask Yours
Post Yours
Write your answer