'Transform labels to normalized encoding.
Parameters
y : array-like of shape [n_samples]
Target values.
Returns
y : array-like of shape [n_samples]'

def transform(self, y):

    check_is_fitted(self, 'classes_')
    y = column_or_1d(y, warn=True)
    classes = np.unique(y)
    if (len(np.intersect1d(classes, self.classes_)) < len(classes)):
        diff = np.setdiff1d(classes, self.classes_)
        raise ValueError(('y    contains    new    labels:    %s' % str(diff)))
    return np.searchsorted(self.classes_, y)
