You are viewing an older version (1.17.1).Go to latest (1.18.0)
{ } Raw JSON

bundles / scipy 1.17.1 / scipy / _lib / array_api_extra / _lib / _funcs / nunique

function

scipy._lib.array_api_extra._lib._funcs:nunique

source: /scipy/_lib/array_api_extra/_lib/_funcs.py:562

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