(numpy)python的shape、size、dtype

python的shape、size、dtype

1.shape

It represents a dimension of the array, several odd row

array_2 = array([[1, 2, 3, 4],
                 [5, 6, 7, 8]])
array_2.shape
>>> (2, 4)

2.size

The number of array elements

array_2.size
>>>8

3.dtype

The type of data

array_2.dtype
>>>dtype('int32')

note:
When the array contains a variety of data types, the most accurate type of output

array_3 = np.array([[1.0, 2, 3], [4.0, 5, 6]])
array_3.dtype
>>>dtype('float64')

Guess you like

Origin blog.csdn.net/weixin_43760295/article/details/93484002