Maximum Allowed Value For A Numpy Data Type
I am working with numpy arrays of a range of data types (uint8, uint16, int16, etc.). I would like to be able to check whether a number can be represented within the limits of an a
Solution 1:
min_value = np.iinfo(im.dtype).min
max_value = np.iinfo(im.dtype).max
docs:
Solution 2:
You're looking for numpy.iinfo
for integer types. Documentation here.
There's also numpy.finfo
for floating point types. Documentation here.
Post a Comment for "Maximum Allowed Value For A Numpy Data Type"