Skip to main content

can_cast

Check whether a cast between data types is possible according to the given casting rule.
Returns: booleantrue if the cast is allowed under the given rule.

common_type

Return the common data type that can represent all input arrays without loss of precision.
Returns: DType — The common type that can hold values from all input arrays.

result_type

Determine the result data type from a set of arrays and/or dtypes, applying NumPy’s type promotion rules.
Returns: DType — The dtype that would result from an operation on the given inputs.

min_scalar_type

Return the minimum-size dtype that can hold the given scalar value without overflow or loss of precision.
Returns: DType — The smallest dtype capable of representing the value.

issubdtype

Check whether the first dtype is a subtype of the second. This follows NumPy’s type hierarchy where, for example, all integer types are subtypes of 'integer' and all floating types are subtypes of 'floating'.
Returns: booleantrue if arg1 is a subtype of arg2.

typename

Return a human-readable type name for a numeric type code.
Returns: string — A descriptive string for the type code.

mintypecode

Return the minimum-size type character from the given type characters that can hold all of them. Optionally restricted to a given set of types.
Returns: string — The minimum type character that encompasses all inputs.