@classmethod
def apply(cls, x, palette, na_value=None):
    """
        Scale data discretely

        Parameters
        ----------
        x : array_like
            Discrete values to scale
        palette : callable ``f(x)``
            Palette to use
        na_value : object
            Value to use for missing values.

        Returns
        -------
        out : array_like
            Scaled values
        """
    limits = cls.train(x)
    return cls.map(x, palette, limits, na_value)
