[ Web Proxy ]
URL:
Viewing: https://numpy.org/doc/stable/reference/generated/../generated/numpy.ma.minimum_fill_value.html [Back]  [Original]

numpy.ma.minimum_fill_value — NumPy v2.5 Manual
Back to top
Search the docs ...:

numpy.ma.minimum_fill_value#

ma.minimum_fill_value(obj)[source]#

Return the maximum value that can be represented by the dtype of an object.

This function is useful for calculating a fill value suitable for taking the minimum of an array with a given dtype.

Parameters:
objndarray, dtype or scalar

An object that can be queried for its numeric type.

Returns:
valscalar

The maximum representable value.

Raises:
TypeError

If obj isnt a suitable numeric type.

See also

maximum_fill_value

The inverse function.

set_fill_value

Set the filling value of a masked array.

MaskedArray.fill_value

Return current fill value.

Examples

Try it in your browser!
>>> import numpy as np
>>> import numpy.ma as ma
>>> a = np.int8()
>>> ma.minimum_fill_value(a)
127
>>> a = np.int32()
>>> ma.minimum_fill_value(a)
2147483647

An array of numeric data can also be passed.

>>> a = np.array([1, 2, 3], dtype=np.int8)
>>> ma.minimum_fill_value(a)
127
>>> a = np.array([1, 2, 3], dtype=np.float32)
>>> ma.minimum_fill_value(a)
inf

Web Proxy Viewer  |  New URL  |  Original Page