def avg(ts):
    """Calculates the average of the timeseries.

    Args:
        ts: A timeseries list of [time, value].

    Returns:
        Average of the timeseries.
    """
    return sum([float(v[1]) for v in ts]) / len(ts)