Wednesday, July 3, 2024
HomeLanguagesPythonnumpy.ndarray.dtype() function – Python

numpy.ndarray.dtype() function – Python

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

Syntax : numpy.ndarray.dtype()

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

Ted Musemwa
As a software developer I’m interested in the intersection of computational thinking and design thinking when solving human problems. As a professional I am guided by the principles of experiential learning; experience, reflect, conceptualise and experiment.
RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments