numpy.zeros usage python study notes 1

The function zeros() is in module numpy

import numpy as np

The function of this function is to create a matrix of a given type and initialize it to 0

用法:zeros(shape, dtype=float, order='C')

shape: specifies the new matrix size

np.zeros(2)
array([ 0.,  0.,])

np.zeros((2, 1))或np.zeros([2, 1])

array([[ 0.],

       [ 0.]])

dtype: array data type, default is float

order: the way to arrange in memory (in C language or Fortran language), the default is C language arrangement


Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325560740&siteId=291194637