bundles / numpy 2.4.4 / numpy / min_scalar_type
_ArrayFunctionDispatcher
numpy:min_scalar_type
Signature
def min_scalar_type ( a , / ) Summary
For scalar a, returns the data type with the smallest size and smallest scalar kind which can hold its value. For non-scalar array a, returns the vector's dtype unmodified.
Extended Summary
Floating point values are not demoted to integers, and complex values are not demoted to floats.
Parameters
a: scalar or array_likeThe value whose minimal data type is to be found.
Returns
out: dtypeThe minimal data type.
Examples
import numpy as np np.min_scalar_type(10)✓
np.min_scalar_type(-260)
✓np.min_scalar_type(3.1)
✓np.min_scalar_type(1e50)
✓np.min_scalar_type(np.arange(4,dtype='f8'))
✓See also
- can_cast
- dtype
- promote_types
- result_type
Aliases
-
numpy.min_scalar_type