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 :
# Python program explaining # numpy.find_common_type() function # importing numpy as geek import numpy as geek
gfg = geek.find_common_type([geek.float32], [geek.int64, geek.float64])
print (gfg)
|
Output :
float32
Code #2 :
# Python program explaining # numpy.find_common_type() function # importing numpy as geek import numpy as geek
gfg = geek.find_common_type([geek.float32], [ complex ])
print (gfg)
|
Output :
complex128
Article Tags :