NumPy - numpy.argmax

2021/11/14 23:42:38

本文主要是介绍NumPy - numpy.argmax,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

NumPy - numpy.argmax

NumPy Manual
https://numpy.org/doc/stable/index.html

numpy.argmax
https://numpy.org/doc/stable/reference/generated/numpy.argmax.html

1. numpy.argmax

numpy.argmax(a, axis=None, out=None)

Returns the indices of the maximum values along an axis.
返回沿轴的最大值的索引。

Parameters

a: array_like
Input array.

axis: int, optional
By default, the index is into the flattened array, otherwise along the specified axis.
默认情况下,索引位于扁平数组中,否则沿指定轴。

out: array, optional
If provided, the result will be inserted into this array. It should be of the appropriate shape and dtype.
如果提供,结果将被插入到这个数组中。 它应该具有适当的 shape and dtype。

Returns

index_array: ndarray of ints
Array of indices into the array. It has the same shape as a.shape with the dimension along axis removed.
数组中的索引数组。它具有与 a.shape 相同的形状,但沿轴的维度已被移除。

1.1 Notes

In case of multiple occurrences of the maximum values, the indices corresponding to the first occurrence are returned.
如果最大值出现多次,则返回第一次出现对应的索引。

1.2 Examples

References

https://numpy.org/doc/stable/reference/generated/numpy.argmax.html



这篇关于NumPy - numpy.argmax的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!


扫一扫关注最新编程教程