array_api_extra.nunique¶
- array_api_extra.nunique(x, /, *, xp=None)¶
Count the number of unique elements in an array.
Compatible with JAX and Dask, whose laziness would be otherwise problematic.
- Parameters:
x (Array) – Input array.
xp (array_namespace, optional) – The standard-compatible namespace for x. Default: infer.
- Returns:
array – The number of unique elements in x. It can be lazy.
- Return type:
0-dimensional integer array