summarize
The () function returns a new array of the given shape and data type, with the values of the elements set to 1. This function is very similar to the numpy zeros() function.
usage
(shape, dtype=None, order='C')
: An integer type or an integer tuple that defines the size of the array. If only an integer type variable is specified, a one-dimensional array is returned. If an integer tuple is specified, an array of the given shape is returned.
: Optional parameter, default value is float. used to specify the data type of the array.
: Specifies whether the memory re-stores multidimensional arrays in row-first ('C') or column-first ('F') order.
(for) instance
import numpy as np array = (3) array
OUT:
import numpy as np array = ((2, 3)) array
OUT:
import numpy as np array = ((2, 3), dtype=int) array
OUT:
import numpy as np array = ((2, 3), dtype=[('x', 'int'), ('y', 'float')]) array
OUT:
to this article on the use of the summary of the article is introduced to this, more related to the use of content please search for my previous articles or continue to browse the following related articles I hope you will support me more in the future!