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 :



filter_none

edit
close

play_arrow

link
brightness_4
code

# 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)

chevron_right


Output :

8

 
Code #2 :

filter_none

edit
close

play_arrow

link
brightness_4
code

# 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)

chevron_right


Output :

16
My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.


Article Tags :

Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.