def _unique(x):
    if x is None or len(x) == 0:
        return np.array([], dtype=np.int64)
    # WARNING: only keep positive values.
    # cluster=-1 means "unclustered".
    x = _as_array(x)
    x = x[x >= 0]
    bc = np.bincount(x)
    return np.nonzero(bc)[0]
Faster version of np.unique().
dataset/ETHPy150Open kwikteam/phy/phy/io/array.py/_unique