numpy 1.22.4 Pypi GitHub Homepage
Other Docs
ParametersReturnsBackRef
issubdtype(arg1, arg2)

This is like the builtin issubclass , but for dtype \ s.

Parameters

arg1, arg2 : dtype_like

dtype or object coercible to one

Returns

out : bool

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

See Also

arrays.scalars

Overview of the numpy type hierarchy.

issubclass_
issubsctype

Examples

issubdtype can be used to check the type of arrays:

>>> ints = np.array([1, 2, 3], dtype=np.int32)
... np.issubdtype(ints.dtype, np.integer) True
>>> np.issubdtype(ints.dtype, np.floating)
False
>>> floats = np.array([1, 2, 3], dtype=np.float32)
... np.issubdtype(floats.dtype, np.integer) False
>>> np.issubdtype(floats.dtype, np.floating)
True

Similar types of different sizes are not subdtypes of each other:

>>> np.issubdtype(np.float64, np.float32)
False
>>> np.issubdtype(np.float32, np.float64)
False

but both are subtypes of floating :

>>> np.issubdtype(np.float64, np.floating)
True
>>> np.issubdtype(np.float32, np.floating)
True

For convenience, dtype-like objects are allowed too:

>>> np.issubdtype('S1', np.string_)
True
>>> np.issubdtype('i4', np.signedinteger)
True
See :

Back References

The following pages refer to to this document either explicitly or contain code examples using this.

numpy.obj2sctype numpy.issubdtype numpy.issubclass_ numpy.issctype numpy.issubsctype

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


GitHub : /numpy/core/numerictypes.py#356
type: <class 'function'>
Commit: