{ } Raw JSON

bundles / scipy 1.18.0 / scipy / _external / array_api_extra / _lib / _funcs / nunique

function

scipy._external.array_api_extra._lib._funcs:nunique

source: /scipy/_external/array_api_extra/_lib/_funcs.py:595

Signature

def nunique(x: Array, /, xp: ModuleType | None = None) → Array

Summary

Count the number of unique elements in an array.

Extended Summary

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: 0-dimensional integer array

The number of unique elements in x. It can be lazy.

Aliases

  • scipy.differentiate.xpx.nunique