📜  numpy.obj2sctype()函数- Python

📅  最后修改于: 2022-05-13 01:54:19.640000             🧑  作者: Mango

numpy.obj2sctype()函数- Python

numpy.obj2sctype()函数返回对象的Python类型的标量 dtype 或 NumPy 等效项。

代码#1:

# Python program explaining
# numpy.obj2sctype() function
           
# importing numpy as geek 
import numpy as geek 
       
gfg = geek.obj2sctype(geek.float64)
     
print (gfg)

输出 :

class 'numpy.float64'


代码#2:

# Python program explaining
# numpy.obj2sctype() function
           
# importing numpy as geek 
import numpy as geek 
       
gfg = geek.obj2sctype(geek.array([1.j]))
     
print (gfg)

输出 :

class 'numpy.complex128'