numpy.nanargmax
- 
numpy.nanargmax(a, axis=None)[source] - 
Return the indices of the maximum values in the specified axis ignoring NaNs. For all-NaN slices
ValueErroris raised. Warning: the results cannot be trusted if a slice contains only NaNs and -Infs.Parameters: - 
a : array_like - 
Input data.
 - 
axis : int, optional - 
Axis along which to operate. By default flattened input is used.
 
Returns: - 
index_array : ndarray - 
An array of indices or a single index value.
 
Examples
>>> a = np.array([[np.nan, 4], [2, 3]]) >>> np.argmax(a) 0 >>> np.nanargmax(a) 1 >>> np.nanargmax(a, axis=0) array([1, 0]) >>> np.nanargmax(a, axis=1) array([1, 1])
 - 
 
    © 2005–2019 NumPy Developers
Licensed under the 3-clause BSD License.
    https://docs.scipy.org/doc/numpy-1.16.1/reference/generated/numpy.nanargmax.html