Monday, November 18, 2024
Google search engine
HomeLanguagesnumpy.ndarray.itemsize() method | Python

numpy.ndarray.itemsize() method | Python

numpy.ndarray.itemsize() function return the length of one array element in bytes.

Syntax : numpy.ndarray.itemsize(arr)

Parameters :
arr : [array_like] Input array.

Return : [int] The length of one array element in bytes

Code #1 :




# Python program explaining
# numpy.ndarray.itemsize() function
  
# importing numpy as geek 
import numpy as geek
  
arr = geek.array([1, 2, 3, 4], dtype = geek.float64)
  
gfg = arr.itemsize
  
print (gfg)


Output :

8

 
Code #2 :




# Python program explaining
# numpy.ndarray.itemsize() function
  
# importing numpy as geek 
import numpy as geek
  
arr = geek.array([1, 2, 3, 4],  dtype = geek.complex128)
  
gfg = arr.itemsize
  
print (gfg)


Output :

16
Dominic Rubhabha-Wardslaus
Dominic Rubhabha-Wardslaushttp://wardslaus.com
infosec,malicious & dos attacks generator, boot rom exploit philanthropist , wild hacker , game developer,
RELATED ARTICLES

Most Popular

Recent Comments