numpy.result_type() function – Python Last Updated : 18 Jun, 2020 Comments Improve Suggest changes Like Article Like Report numpy.result_type() function returns the type that results from applying the NumPy type promotion rules to the arguments. NumPy type promotion by example : Suppose calculating 3*arr, where arr is an array of 32-bit floats, intuitively should result in a 32-bit float output. If the 3 is a 32-bit integer, the NumPy rules indicate it can’t convert losslessly into a 32-bit float, so a 64-bit float should be the result type. Syntax : numpy.result_type(arrays_and_dtypes) Parameters : arrays_and_dtypes : [list of arrays and dtypes] The operands of some operation whose result type is needed. Return : [dtype] Return the result type. Code #1 : Python3 # Python program explaining # numpy.result_type() function # importing numpy as geek import numpy as geek gfg = geek.result_type('f4', 'i8') print (gfg) Output : float64 Code #2 : Python3 # Python program explaining # numpy.result_type() function # importing numpy as geek import numpy as geek gfg = geek.result_type(3, geek.arange(7, dtype = 'i1')) print (gfg) Output : int8 Comment More infoAdvertise with us Next Article numpy.result_type() function – Python S sanjoy_62 Follow Improve Article Tags : Python Python-numpy Practice Tags : python Similar Reads numpy.real() function - Python numpy.real() function return the real part of the complex argument. Syntax : numpy.real(arr) Parameters : arr : [array_like] Input array. Return : [ndarray or scalar] The real component of the complex argument. If val is real, the type of val is used for the output. If val has complex elements, the 1 min read numpy.typename() function â Python numpy.typename() function return a description for the given data type code. Syntax : numpy.typename(char) Parameters : char : [str] Data type code. Return : [str] Description of the input data type code. Code #1 : Python3 # Python program explaining # numpy.typename() function # importing numpy as 2 min read numpy.sctype2char() function â Python numpy.sctype2char() function return the string representation of a scalar dtype. Syntax : numpy.sctype2char(sctype) Parameters : sctype : [scalar dtype or object] If a sctype is a scalar dtype, the corresponding string character is returned. If an object, sctype2char tries to infer its scalar type a 1 min read numpy.dtype.subdtype() function â Python numpy.dtype.subdtype() function returns Tuple(item_dtype, shape) if this dtype describes a sub-array, and None otherwise. Syntax : numpy.dtype.subdtype(type) type : [dtype] The input data-type. Return : Return Tuple(item_dtype, shape) if this dtype describes a sub-array, and None otherwise. Code #1 1 min read numpy.roots() function - Python numpy.roots() function return the roots of a polynomial with coefficients given in p. The values in the rank-1 array p are coefficients of a polynomial. If the length of p is n+1 then the polynomial is described by: p[0] * x**n + p[1] * x**(n-1) + ... + p[n-1]*x + p[n] Syntax : numpy.roots(p) Parame 1 min read Like