def variance(iterable, sample=False):
    # Sample variance = E((xi-m)^2) / (n-1)
    # Population variance = E((xi-m)^2) / n
    a = iterable if isinstance(iterable, list) else list(iterable)
    m = mean(a)
    return sum((x - m) ** 2 for x in a) / (len(a) - int(sample) or 1)
Returns the variance of the given list of values.
dataset/ETHPy150Open clips/pattern/pattern/metrics.py/variance