isdtype¶
- isdtype(dtype: dtype, kind: dtype | str | Tuple[dtype | str, ...]) bool¶
Returns a boolean indicating whether a provided dtype is of a specified data type “kind”.
- Parameters:
dtype (dtype) – the input dtype.
kind (Union[str, dtype, Tuple[Union[str, dtype], ...]]) –
data type kind.
If
kindis a dtype, the function must return a boolean indicating whether the inputdtypeis equal to the dtype specified bykind.If
kindis a string, the function must return a boolean indicating whether the inputdtypeis of a specified data type kind. The following dtype kinds must be supported:'bool': boolean data types (e.g.,bool).'signed integer': signed integer data types (e.g.,int8,int16,int32,int64).'unsigned integer': unsigned integer data types (e.g.,uint8,uint16,uint32,uint64).'integral': integer data types. Shorthand for('signed integer', 'unsigned integer').'real floating': real-valued floating-point data types (e.g.,float32,float64).'complex floating': complex floating-point data types (e.g.,complex64,complex128).'numeric': numeric data types. Shorthand for('integral', 'real floating', 'complex floating').
If
kindis a tuple, the tuple specifies a union of dtypes and/or kinds, and the function must return a boolean indicating whether the inputdtypeis either equal to a specified dtype or belongs to at least one specified data type kind.
Note
A conforming implementation of the array API standard is not limited to only including the dtypes described in this specification in the required data type kinds. For example, implementations supporting
float16andbfloat16can includefloat16andbfloat16in thereal floatingdata type kind. Similarly, implementations supportingint128can includeint128in thesigned integerdata type kind.In short, conforming implementations may extend data type kinds; however, data type kinds must remain consistent (e.g., only integer dtypes may belong to integer data type kinds and only floating-point dtypes may belong to floating-point data type kinds), and extensions must be clearly documented as such in library documentation.
- Returns:
out (bool) – boolean indicating whether a provided dtype is of a specified data type kind.
Notes
New in version 2022.12.