numpy.find_common_type() function – Python
Last Updated :
18 Jun, 2020
numpy.find_common_type()
function determine common type following standard coercion rules.
Syntax : numpy.find_common_type(array_types, scalar_types)
Parameters :
array_types : [sequence] A list of dtypes or dtype convertible objects representing arrays.
scalar_types : [sequence] A list of dtypes or dtype convertible objects representing scalars.
Return : [dtype] The common data type, which is the maximum of array_types ignoring scalar_types, unless the maximum of scalar_types is of a different kind.
Code #1 :
import numpy as geek
gfg = geek.find_common_type([geek.float32], [geek.int64, geek.float64])
print (gfg)
|
Output :
float32
Code #2 :
import numpy as geek
gfg = geek.find_common_type([geek.float32], [ complex ])
print (gfg)
|
Output :
complex128
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...