nanargmax

Contents

nanargmax#

class saiunit.math.nanargmax(a, axis=None, keepdims=False, **kwargs)#

Return the index of the maximum value, ignoring NaNs.

Units are stripped before finding the maximum.

Parameters:
  • a (Array | ndarray | bool | number | bool | int | float | complex | saiunit.Quantity) – Input data.

  • axis (int) – Axis along which to operate. By default the flattened input is used.

  • keepdims (bool) – If True, reduced axes are kept with size one.

Returns:

index – Index of the maximum value (NaNs ignored).

Return type:

Array

Examples

>>> import saiunit as u
>>> import jax.numpy as jnp
>>> u.math.nanargmax(jnp.array([1.0, jnp.nan, 3.0]))
Array(2, dtype=int32)