Return the weighted arithmetic mean of x

def amean(x, weights=None):
    """
    Return the weighted arithmetic mean of x
    """
    w_arr, x_arr = _preprocess_inputs(x, weights)
    return (w_arr*x_arr).sum(axis=0) / w_arr.sum(axis=0)