def quantile_gaussianize(x):
from scipy.stats import norm, rankdata<EOL>x = asarray(x, float).copy()<EOL>ok = isfinite(x)<EOL>x[ok] *= -<NUM_LIT:1><EOL>y = empty_like(x)<EOL>y[ok] = rankdata(x[ok])<EOL>y[ok] = norm.isf(y[ok] / (sum(ok) + <NUM_LIT:1>))<EOL>y[~ok] = x[~ok]<EOL>return y<EOL>
Normalize a sequence of values via rank and Normal c.d.f.

    Args:
        x (array_like): sequence of values.

    Returns:
        Gaussian-normalized values.

    Example:

    .. doctest::

        >>> from scipy_sugar.stats import quantile_gaussianize
        >>> print(quantile_gaussianize([-1, 0, 2]))
        [-0.67448975  0.          0.67448975]