you could also do ``labels, y = unique(return_inverse, y)`` with ``from sklearn.utils.fixes import unique``.