librosa.util.is_unique

librosa.util.is_unique(data, *, axis=- 1)[source]

Determine if the input array consists of all unique values along a given axis.

Parameters
datanp.ndarray

The input array

axisint

The target axis

Returns
is_unique

Array of booleans indicating whether the data is unique along the chosen axis. This array will have one fewer dimension than the input.

See also

count_unique

Examples

>>> x = np.vander(np.arange(5))
>>> x
array([[  0,   0,   0,   0,   1],
   [  1,   1,   1,   1,   1],
   [ 16,   8,   4,   2,   1],
   [ 81,  27,   9,   3,   1],
   [256,  64,  16,   4,   1]])
>>> # Check uniqueness along rows
>>> librosa.util.is_unique(x, axis=0)
array([ True,  True,  True,  True, False])
>>> # Check uniqueness along columns
>>> librosa.util.is_unique(x, axis=-1)
array([False, False,  True,  True,  True])