NumPy | nbytes property
nbytes property returns the memory consumed by all the elements of the array in bytes.
a = np.array([4,5,6], dtype="int32")a.nbytes12
Here, each number in the array is represented as a
int32, which means that each item consumes 4 bytes of memory. Since we have 3 elements in the array, the total number of bytes consumed is