Inspect NumPy Array¶
In [2]:
import numpy as np
In [3]:
arr = np.array([[1,2,3], [4,5,6]], dtype=np.int64)
arr
Out[3]:
Inspect general information of an array¶
In [4]:
print(np.info(arr))
Inspect the data type of an array¶
In [5]:
print(arr.dtype)
Inspect the dimension of an array¶
In [6]:
print(arr.shape)
Inspect length of an array¶
In [7]:
print(len(arr))
Inspect the number of dimensions of an array¶
In [8]:
print(arr.ndim)
Inspect the number of elements in an array¶
In [9]:
print(arr.size)
Inspect the number of bytes of each element in an array¶
In [10]:
print(arr.itemsize)
Inspect the memory size of an array (in byte)¶
In [11]:
# arr.nbytes = arr.size * arr.itemsize
print(arr.nbytes)