#itemsize shows the length of one array element in bytes
import numpy as np
a = np.array([[1,2,3],[4,5,6]],dtype = np.int64)
a.itemsize
#output will be 8
np_array.size
import numpy as np
arr = np.array([1,2,3])
arr.ndim
myArray.shape # Returns the number of rows, columns etc. (depends on dimensions how many numbers you get)
print(a_1d.shape)
# (3,)
print(type(a_1d.shape))
# <class 'tuple'>
print(a_2d.shape)
# (3, 4)
print(a_3d.shape)
# (2, 3, 4)
# Python program explaining
# numpy.size() method
# importing numpy
import numpy as np
# Making a random array
arr = np.array([[1, 2, 3, 4], [5, 6, 7, 8]])
# count the number of elements along the axis.
# Here rows and columns are being treated
# as elements
#gives no. of rows along x-axis
print(np.size(arr, 0))
#gives no. of columns along y-axis
print(np.size(arr, 1))
x = np.zeros((3, 5, 2), dtype=np.complex128)
>>> x.size
30
>>> np.prod(x.shape)
30
a = np.arange(3)
b = np.arange(12).reshape((3, 4))
c = np.arange(24).reshape((2, 3, 4))
# it returns the total number of elements
print(a.size) # 3
print(b.size) # 12
print(c.size) # 24
a = np.arange(3)
b = np.arange(12).reshape((3, 4))
c = np.arange(24).reshape((2, 3, 4))
print(a.ndim) # 1
print(b.ndim) # 2
print(c.ndim) # 3