📜  numpy.mintypecode()函数– Python

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

numpy.mintypecode()函数– Python

numpy.mintypecode()函数返回可以安全地将给定类型转换为的最小大小类型的字符。

代码#1:

# Python program explaining
# numpy.mintypecode() function
            
# importing numpy as geek 
import numpy as geek 
  
gfg = geek.mintypecode(['d', 'f', 'S'])
  
print (gfg)

输出 :

d


代码#2:

# Python program explaining
# numpy.mintypecode() function
            
# importing numpy as geek 
import numpy as geek 
  
x = geek.array([1.1, 2-1.j])
  
gfg = geek.mintypecode(x)
  
print (gfg)

输出 :

D