You are viewing an older version (2.4.3). Go to latest (2.4.4)
{ } Raw JSON

bundles / numpy 2.4.3 / numpy / common_type

_ArrayFunctionDispatcher

numpy:common_type

source: /numpy/lib/_type_check_impl.py :657

Signature

def   common_type ( * arrays )

Summary

Return a scalar type which is common to the input arrays.

Extended Summary

The return type will always be an inexact (i.e. floating point) scalar type, even if all the arrays are integer arrays. If one of the inputs is an integer array, the minimum precision type that is returned is a 64-bit floating point dtype.

All input arrays except int64 and uint64 can be safely cast to the returned dtype without loss of information.

Parameters

array1, array2, ... : ndarrays

Input arrays.

Returns

out : data type code

Data type code.

Examples

np.common_type(np.arange(2, dtype=np.float32))
np.common_type(np.arange(2, dtype=np.float32), np.arange(2))
np.common_type(np.arange(4), np.array([45, 6.j]), np.array([45.0]))

See also

dtype
mintypecode

Aliases

  • numpy.common_type