numpy.ma.masked_array.argmin

method

ma.masked_array.argmin(axis=None, fill_value=None, out=None, *, keepdims=<no value>)[source]

Return array of indices to the minimum values along the given axis.

Parameters
axis{None, integer}

If None, the index is into the flattened array, otherwise along the specified axis

fill_valuescalar or None, optional

Value used to fill in the masked values. If None, the output of minimum_fill_value(self._data) is used instead.

out{None, array}, optional

Array into which the result can be placed. Its type is preserved and it must be of the right shape to hold the output.

Returns
ndarray or scalar

If multi-dimension input, returns a new ndarray of indices to the minimum values along the given axis. Otherwise, returns a scalar of index to the minimum values along the given axis.

Examples

>>> x = np.ma.array(np.arange(4), mask=[1,1,0,0])
>>> x.shape = (2,2)
>>> x
masked_array(
  data=[[--, --],
        [2, 3]],
  mask=[[ True,  True],
        [False, False]],
  fill_value=999999)
>>> x.argmin(axis=0, fill_value=-1)
array([0, 0])
>>> x.argmin(axis=0, fill_value=9)
array([1, 1])