numpy.dtype.isbuiltin

attribute

dtype.isbuiltin

Integer indicating how this dtype relates to the built-in dtypes.

Read-only.

0

if this is a structured array type, with fields

1

if this is a dtype compiled into numpy (such as ints, floats etc)

2

if the dtype is for a user-defined numpy type A user-defined type uses the numpy C-API machinery to extend numpy to handle a new array type. See User-defined data-types in the NumPy manual.

Examples

>>> dt = np.dtype('i2')
>>> dt.isbuiltin
1
>>> dt = np.dtype('f8')
>>> dt.isbuiltin
1
>>> dt = np.dtype([('field1', 'f8')])
>>> dt.isbuiltin
0

© 2005–2020 NumPy Developers
Licensed under the 3-clause BSD License.
https://numpy.org/doc/1.19/reference/generated/numpy.dtype.isbuiltin.html