Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

numpy.ndarray.dtype() function – Python

  • Last Updated : 11 Jun, 2020

numpy.ndarray.dtype() function return the data-type of the array’s elements.

Syntax : numpy.ndarray.dtype()

 Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.  

To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning - Basic Level Course

Parameters : None



Return : [numpy dtype object] Return the data-type of the array’s elements.

Code #1 :




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

Output :

int64

 
Code #2 :




# Python program explaining
# numpy.ndarray.dtype() function
         
# importing numpy as geek 
import numpy as geek 
     
arr = geek.array([  0.1.2.])
   
gfg = arr.dtype
   
print (gfg)

Output :

float64
My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!