nlcpy.argmax
- nlcpy.argmax(a, axis=None, out=None)
- Returns the indices of the maximum values along an axis. - Parameters
- aarray_like
- Input array. 
- axisint, optional
- By default, the index is into the flattened array, otherwise along the specified axis. 
- outndarray, optional
- If provided, the result will be inserted into this array. It should be of the appropriate shape and dtype. 
 
- Returns
- index_arrayndarray of ints
- Array of indices into the array. It has the same shape as a.shape with the dimension along axis removed. 
 
 - 参考 - 注釈 - In case of multiple occurrences of the maximum values, the indices corresponding to the first occurrence are returned. - Examples - >>> import nlcpy as vp >>> a = vp.arange(6).reshape(2,3) + 10 >>> a array([[10, 11, 12], [13, 14, 15]]) >>> vp.argmax(a) array(5) >>> vp.argmax(a, axis=0) array([1, 1, 1]) >>> vp.argmax(a, axis=1) array([2, 2]) - >>> b = vp.arange(6) >>> b[1] = 5 >>> b array([0, 5, 2, 3, 4, 5]) >>> vp.argmax(b) # Only the first occurrence is returned. array(1)