bundles / numpy 2.5.0.dev0+git20251130.2de293a / numpy / unique_all
_ArrayFunctionDispatcher
numpy:unique_all
source: /dev/numpy/build-install/usr/lib/python3.14/site-packages/numpy/lib/_arraysetops_impl.py :440
Signature
def unique_all ( x ) Summary
Find the unique elements of an array, and counts, inverse, and indices.
Extended Summary
This function is an Array API compatible alternative to
np.unique(x, return_index=True, return_inverse=True, return_counts=True, equal_nan=False, sorted=False)
but returns a namedtuple for easier access to each output.
Parameters
x: array_likeInput array. It will be flattened if it is not already 1-D.
Returns
out: namedtupleThe result containing:
values - The unique elements of an input array.
indices - The first occurring indices for each unique element.
inverse_indices - The indices from the set of unique elements that reconstruct
x.counts - The corresponding counts for each unique element.
Examples
import numpy as np x = [1, 1, 2] uniq = np.unique_all(x) uniq.values uniq.indices uniq.inverse_indices uniq.counts✓
See also
- unique
Find the unique elements of an array.
Aliases
-
numpy.unique_all