MCPcopy
hub / github.com/numpy/numpy / argmin

Method argmin

numpy/ma/core.py:5694–5740  ·  view source on GitHub ↗

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_value : scalar or None, optional

(self, axis=None, fill_value=None, out=None, *,
                keepdims=np._NoValue)

Source from the content-addressed store, hash-verified

5692 return filled.argsort(axis=axis, kind=kind, order=order)
5693
5694 def argmin(self, axis=None, fill_value=None, out=None, *,
5695 keepdims=np._NoValue):
5696 """
5697 Return array of indices to the minimum values along the given axis.
5698
5699 Parameters
5700 ----------
5701 axis : {None, integer}
5702 If None, the index is into the flattened array, otherwise along
5703 the specified axis
5704 fill_value : scalar or None, optional
5705 Value used to fill in the masked values. If None, the output of
5706 minimum_fill_value(self._data) is used instead.
5707 out : {None, array}, optional
5708 Array into which the result can be placed. Its type is preserved
5709 and it must be of the right shape to hold the output.
5710
5711 Returns
5712 -------
5713 ndarray or scalar
5714 If multi-dimension input, returns a new ndarray of indices to the
5715 minimum values along the given axis. Otherwise, returns a scalar
5716 of index to the minimum values along the given axis.
5717
5718 Examples
5719 --------
5720 >>> import numpy as np
5721 >>> x = np.ma.array(np.arange(4), mask=[1,1,0,0])
5722 >>> x = x.reshape((2,2))
5723 >>> x
5724 masked_array(
5725 data=[[--, --],
5726 [2, 3]],
5727 mask=[[ True, True],
5728 [False, False]],
5729 fill_value=999999)
5730 >>> x.argmin(axis=0, fill_value=-1)
5731 array([0, 0])
5732 >>> x.argmin(axis=0, fill_value=9)
5733 array([1, 1])
5734
5735 """
5736 if fill_value is None:
5737 fill_value = minimum_fill_value(self)
5738 d = self.filled(fill_value).view(ndarray)
5739 keepdims = False if keepdims is np._NoValue else bool(keepdims)
5740 return d.argmin(axis, out=out, keepdims=keepdims)
5741
5742 def argmax(self, axis=None, fill_value=None, out=None, *,
5743 keepdims=np._NoValue):

Callers 12

test_argmaxFunction · 0.45
test_attributesMethod · 0.45
test_combinationsMethod · 0.45
test_argmin_with_outMethod · 0.45
nanargminFunction · 0.45
ndarray_misc.pyFile · 0.45
fromnumeric.pyFile · 0.45
test_testArrayMethodsMethod · 0.45
test_generic_methodsMethod · 0.45
test_argmax_argminMethod · 0.45
time_argminMethod · 0.45

Calls 3

filledMethod · 0.95
minimum_fill_valueFunction · 0.85
viewMethod · 0.45

Tested by

no test coverage detected