Data type routines — NumPy v2.6.dev0 Manual

can_cast

(from_, to[, casting])

Returns True if cast between data types can occur according to the casting rule.

promote_types

(type1, type2, /)

Returns the data type with the smallest size and smallest scalar kind to which both type1 and type2 may be safely cast.

min_scalar_type

(a, /)

For scalar a, returns the data type with the smallest size and smallest scalar kind which can hold its value.

result_type

(*arrays_and_dtypes)

Returns the type that results from applying the NumPy

type promotion

rules to the arguments.

common_type

(*arrays)

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

Creating data types

#

dtype

(dtype[, align, copy])

rec.format_parser

(formats, names, titles[, ...])

Class to convert formats, names, titles description to a dtype.

Data type information

#

finfo

(dtype)

Machine limits for floating point types.

iinfo

(type)

Machine limits for integer types.

Data type testing

#

isdtype

(dtype, kind)

Determine if a provided dtype is of a specified data type kind.

issubdtype

(arg1, arg2)

Returns True if first argument is a typecode lower/equal in type hierarchy.

Miscellaneous

#

typename

(char)

Return a description for the given data type code.

mintypecode

(typechars[, typeset, default])

Return the character for the minimum-size type to which given types can be safely cast.