input_obj: npt.DTypeLike | _ArrayLikeOrScalar[NumberType],
base_dtype: npt.DTypeLike | tuple[npt.DTypeLike, ...] | list[npt.DTypeLike],
name: str = 'Input',

Check if an input’s data-type is a subtype of another data-type(s).

input_objfloat | ArrayLike[float] | numpy.typing.DTypeLike

dtype object (or object coercible to one) or an array-like object. If array-like, the dtype of the array is used.

base_dtypenumpy.typing.DTypeLike | Sequence[numpy.typing.DTypeLike]

dtype-like object or a sequence of dtype-like objects. The input_obj must be a subtype of this value. If a sequence, input_obj must be a subtype of at least one of the specified dtypes.

namestr, default: “Input”

Variable name to use in the error messages if any are raised.


If input_obj is not a subtype of base_dtype.


Check if float is a subtype of np.floating.

>>> import numpy as np
>>> from pyvista import _validation
>>> _validation.check_subdtype(float, np.floating)

Check from multiple allowable dtypes.

>>> _validation.check_subdtype(int, [np.integer, np.floating])

Check an array’s dtype.

>>> array = np.array([1, 2, 3], dtype='uint8')
>>> _validation.check_subdtype(array, np.integer)