numpy.argmin(array,axis = None,out = None):返回特定轴上数组min元素的索引。
参数:
array:Input array to work on
axis :[int, optional]Along a specified axis like 0 or 1
out :[array optional]Provides a feature to insert output to the out
array and it should be of appropriate shape and dtype
返回:
Array of indices into the array with same shape as array.shape
with the dimension along axis removed.
代码1:
# Python Program illustrating
# working of argmin()
import numpy as geek
# Working on 1D array
array = geek.arange(8)
print("INPUT ARRAY:\n", array)
# returning Indices of the min element
# as per the indices
print("\nIndices of min element:", geek.argmin(array, axis=0))
输出:
INPUT ARRAY:
[0 1 2 3 4 5 6 7]