MCPcopy Create free account
hub / github.com/numpy/numpy / argmax

Method argmax

numpy/ma/core.py:5638–5675  ·  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

5636 return d.argmin(axis, out=out, keepdims=keepdims)
5637
5638 def argmax(self, axis=None, fill_value=None, out=None, *,
5639 keepdims=np._NoValue):
5640 """
5641 Returns array of indices of the maximum values along the given axis.
5642 Masked values are treated as if they had the value fill_value.
5643
5644 Parameters
5645 ----------
5646 axis : {None, integer}
5647 If None, the index is into the flattened array, otherwise along
5648 the specified axis
5649 fill_value : scalar or None, optional
5650 Value used to fill in the masked values. If None, the output of
5651 maximum_fill_value(self._data) is used instead.
5652 out : {None, array}, optional
5653 Array into which the result can be placed. Its type is preserved
5654 and it must be of the right shape to hold the output.
5655
5656 Returns
5657 -------
5658 index_array : {integer_array}
5659
5660 Examples
5661 --------
5662 >>> a = np.arange(6).reshape(2,3)
5663 >>> a.argmax()
5664 5
5665 >>> a.argmax(0)
5666 array([1, 1, 1])
5667 >>> a.argmax(1)
5668 array([2, 2])
5669
5670 """
5671 if fill_value is None:
5672 fill_value = maximum_fill_value(self._data)
5673 d = self.filled(fill_value).view(ndarray)
5674 keepdims = False if keepdims is np._NoValue else bool(keepdims)
5675 return d.argmax(axis, out=out, keepdims=keepdims)
5676
5677 def sort(self, axis=-1, kind=None, order=None,
5678 endwith=True, fill_value=None):

Callers 15

test_half_funcsMethod · 0.45
test_argmaxMethod · 0.45
test_object_argmaxMethod · 0.45
test_argmax_byteorderMethod · 0.45
test_attributesMethod · 0.45
checkMethod · 0.45
test_combinationsMethod · 0.45
test_argmax_with_outMethod · 0.45
nanargmaxFunction · 0.45
ndarray_misc.pyFile · 0.45

Calls 3

filledMethod · 0.95
maximum_fill_valueFunction · 0.85
viewMethod · 0.45

Tested by 13

test_half_funcsMethod · 0.36
test_argmaxMethod · 0.36
test_object_argmaxMethod · 0.36
test_argmax_byteorderMethod · 0.36
test_attributesMethod · 0.36
checkMethod · 0.36
test_combinationsMethod · 0.36
test_argmax_with_outMethod · 0.36
test_testArrayMethodsMethod · 0.36
test_generic_methodsMethod · 0.36