MCPcopy
hub / github.com/numpy/numpy / argmax

Method argmax

numpy/ma/core.py:5742–5780  ·  view source on GitHub ↗

Returns array of indices of the maximum values along the given axis. Masked values are treated as if they had the value fill_value. Parameters ---------- axis : {None, integer} If None, the index is into the flattened array, otherwise along

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

Source from the content-addressed store, hash-verified

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):
5744 """
5745 Returns array of indices of the maximum values along the given axis.
5746 Masked values are treated as if they had the value fill_value.
5747
5748 Parameters
5749 ----------
5750 axis : {None, integer}
5751 If None, the index is into the flattened array, otherwise along
5752 the specified axis
5753 fill_value : scalar or None, optional
5754 Value used to fill in the masked values. If None, the output of
5755 maximum_fill_value(self._data) is used instead.
5756 out : {None, array}, optional
5757 Array into which the result can be placed. Its type is preserved
5758 and it must be of the right shape to hold the output.
5759
5760 Returns
5761 -------
5762 index_array : {integer_array}
5763
5764 Examples
5765 --------
5766 >>> import numpy as np
5767 >>> a = np.arange(6).reshape(2,3)
5768 >>> a.argmax()
5769 5
5770 >>> a.argmax(0)
5771 array([1, 1, 1])
5772 >>> a.argmax(1)
5773 array([2, 2])
5774
5775 """
5776 if fill_value is None:
5777 fill_value = maximum_fill_value(self._data)
5778 d = self.filled(fill_value).view(ndarray)
5779 keepdims = False if keepdims is np._NoValue else bool(keepdims)
5780 return d.argmax(axis, out=out, keepdims=keepdims)
5781
5782 def sort(self, axis=-1, kind=None, order=None, endwith=True,
5783 fill_value=None, *, stable=False, descending=False):

Callers 15

test_argmaxFunction · 0.45
test_half_funcsMethod · 0.45
test_argmaxMethod · 0.45
test_object_argmaxMethod · 0.45
test_argmax_byteorderMethod · 0.45
test_attributesMethod · 0.45
test_default_dtypesFunction · 0.45
checkMethod · 0.45
test_combinationsMethod · 0.45
test_argmax_with_outMethod · 0.45

Calls 3

filledMethod · 0.95
maximum_fill_valueFunction · 0.85
viewMethod · 0.45

Tested by 15

test_argmaxFunction · 0.36
test_half_funcsMethod · 0.36
test_argmaxMethod · 0.36
test_object_argmaxMethod · 0.36
test_argmax_byteorderMethod · 0.36
test_attributesMethod · 0.36
test_default_dtypesFunction · 0.36
checkMethod · 0.36
test_combinationsMethod · 0.36
test_argmax_with_outMethod · 0.36