pyvista_validation.check.check_integer#
- pyvista_validation.check.check_integer(array, *, strict=False, name='Array')#
Check if an array has integer or integer-like float values.
- Parameters:
- arrayfloat | ArrayLikeFloat
Number or array to check.
- strictbool, default: False
If
True, the array’s data must be a subtype ofintornp.integer. Otherwise, floats are allowed but must be whole numbers.- namestr, default: “Array”
Variable name to use in the error messages if any are raised.
- Returns:
- array_like
The input, unchanged.
- Raises:
- ValueError
If any element’s value differs from its floor.
- TypeError
If
strict=Trueand the array’sdtypeis not integral.
See also
Examples
Check if an array has integer-like values.
>>> from pyvista_validation import check_integer >>> check_integer([1.0, 2.0]) [1.0, 2.0]