numpy.MaskedArray.argmin() returns an array of indices of the minimum values along the given axis. Masked values are treated as if they had fill_value.
numpy.MaskedArray.argmin (axis = None, fill_value = None, out = None)
axis: [None, integer] If None, the index is into the flattened array, otherwise along the specified axis.
fill_value: [var, optional] Value used to fill in the masked values.
out: [ndarray , optional] A location into which the result is stored.
– & gt; If provided, it must have a shape that the inputs broadcast to.
– & gt; If not provided or None, a freshly-allocated array is returned.
Return: [index_array] A new integer_array is returned unless out is specified, in which case a reference to out is returned.
Code # 1:
code > Output :
Input array: [1 2 3 -1 5] Masked array: [1 2 - -1 5] Index of min element in masked array: 3 pre>
Code # 2: s trong>
Input array: [10 20 30 -10 50] Masked array: [- 20 - -10 50] Index of min element in masked array : 0