def wquantiles(W, x, alphas=(0.25, 0.50, 0.75)):
    """Quantiles for weighted data.

    Parameters
    ----------
    W: (N,) ndarray
        normalised weights (weights are >=0 and sum to one)
    x: (N,) or (N,d) ndarray
        data
    alphas: list-like of size k (default: (0.25, 0.50, 0.75))
        probabilities (between 0. and 1.) 

    Returns
    -------
    a (k,) or (d, k) ndarray containing the alpha-quantiles 
    """
    if len(x.shape) == 1:
        return _wquantiles(W, x, alphas=alphas)
    elif len(x.shape) == 2: 
        return np.array([_wquantiles(W, x[:, i], alphas=alphas) 
                         for i in range(x.shape[1])])
def wquantiles ( W , x , alphas = ( 0.25 , 0.50 , 0.75 ) ) : if len ( x . shape ) == 1 : return _wquantiles ( W , x , alphas = alphas ) elif len ( x . shape ) == 2 : return np . array ( [ _wquantiles ( W , x [ : , i ] , alphas = alphas ) for i in range ( x . shape [ 1 ] ) ] )
Quantiles for weighted data.

    Parameters
    ----------
    W: (N,) ndarray
        normalised weights (weights are >=0 and sum to one)
    x: (N,) or (N,d) ndarray
        data
    alphas: list-like of size k (default: (0.25, 0.50, 0.75))
        probabilities (between 0. and 1.) 

    Returns
    -------
    a (k,) or (d, k) ndarray containing the alpha-quantiles