Return the weighted geometric mean of x

def gmean(x, weights=None):
    """
    Return the weighted geometric mean of x
    """
    w_arr, x_arr = _preprocess_inputs(x, weights)
    return np.exp((w_arr*np.log(x_arr)).sum(axis=0) / w_arr.sum(axis=0))