numpy.isdtype — NumPy v2.6.dev0 Manual

numpy.isdtype(dtype, kind)

[source]

#

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

This function only supports built-in NumPy’s data types. Third-party dtypes are not yet supported.

Parameters:dtypedtypeThe input dtype.

kinddtype or str or tuple of dtypes/strs.dtype or dtype kind. Allowed dtype kinds are: * 'bool' : boolean kind * 'signedinteger' : signed integer data types * 'unsignedinteger' : unsigned integer data types * 'integral' : integer data types * 'realfloating' : real-valued floating-point data types * 'complexfloating' : complex floating-point data types * 'numeric' : numeric data types

Returns:outboolExamples

>>> importnumpyasnp>>> np.isdtype(np.float32,np.float64)False>>> np.isdtype(np.float32,"real floating")True>>> np.isdtype(np.complex128,("real floating","complex floating"))True