Hello Friends!!!
In this article, we are going to learn more methods of NumPy module. At the end of this article, you will be able to work on,
In this article, we are going to learn more methods of NumPy module. At the end of this article, you will be able to work on,
- ones
- zeros
- numpy.ones() - method returns an array with default value 1.0 with given shape or we can say newly returned array filled with 1.0 or 1 based on data type and shape.
- Syntax: numpy.ones(shape, dtype=None, order='C')
- Here, shape - is the shape of an array that you want to retrieve.
- dtype - is an optional argument, represents the data type of an array that you want to retrieve, the default data type is float.
- order{'C','F'} - is an optional argument, represents whether to store multi - dim array in C-style or Fortran style. C-style represents row-major and Fortran-style represents column-major in memory.
- It returns ndarray object in the form of an array with the given shape, order and data type.
- numpy.zeros() - method returns an array with default value 0.0, with given shape or we can say newly returned array filled with 0.0 or 0 based on data type and shape.
- Syntax: numpy.zeros(shape,dtype=float,order='C')
- Here, shape - is the shape of an array that you want to retrieve.
- dtype - is an optional argument, represents the data type of an array that you want to retrieve, the default data type is float.
- order{'C','F'} - is an optional argument, represents whether to store multi - dim array in C-style or Fortran style. C-style represents row-major and Fortran-style represents column-major in memory.
- It returns ndarray object in the form of an array with the given shape, order and data type.
No comments:
Post a Comment