can_cast
Check whether a cast between data types is possible according to the given casting rule.| Parameter | Type | Default | Description |
|---|---|---|---|
from_ | ArrayLike | DType | — | Source value or data type. |
to | DType | — | Target data type. |
casting | 'no' | 'equiv' | 'safe' | 'same_kind' | 'unsafe' | 'safe' | Casting rule. 'no' allows no casting, 'equiv' allows byte-order changes, 'safe' allows only casts that preserve values, 'same_kind' allows safe casts and casts within a kind (e.g. float to float), 'unsafe' allows all casts. |
boolean — true 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.| Parameter | Type | Default | Description |
|---|---|---|---|
...arrays | ArrayLike[] | — | One or more input arrays. |
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.| Parameter | Type | Default | Description |
|---|---|---|---|
...arrays_and_dtypes | (ArrayLike | DType)[] | — | Arrays and/or dtype strings. |
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.| Parameter | Type | Default | Description |
|---|---|---|---|
val | number | bigint | boolean | — | A scalar value. |
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'.
| Parameter | Type | Default | Description |
|---|---|---|---|
dtype1 | ArrayLike | DType | — | The dtype (or array-like value) to test. |
dtype2 | DType | string | — | The dtype or abstract type category to test against (e.g. 'integer', 'floating', 'signedinteger', 'unsignedinteger', 'number'). |
boolean — true if arg1 is a subtype of arg2.
typename
Return a human-readable type name for a numeric type code.| Parameter | Type | Default | Description |
|---|---|---|---|
dtype | DType | — | Dtype code to resolve. |
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.| Parameter | Type | Default | Description |
|---|---|---|---|
typechars | string | — | String of type character codes. |
typeset | string | 'GDFgdf' | Set of allowed type characters. |
default_ | string | 'd' | Default type character returned when typechars is empty. |
string — The minimum type character that encompasses all inputs.