@staticmethod
def formula_linear(col1, col2):
    """ Linear interpolation between data points.

        :return:
        :rtype:
        """
    items = []
    for k in range(len(col1) - 1):
        x1 = col1.iloc[k]
        x2 = col1.iloc[k + 1]
        y1 = col2.iloc[k]
        y2 = col2.iloc[k + 1]
        m = (y2 - y1) / (x2 - x1)
        formula = '{} + {}*(time-{})'.format(y1, m, x1)
        condition = 'time >= {} && time < {}'.format(x1, x2)
        s = '{}, {}'.format(formula, condition)
        items.append(s)
    s = '{}, time >= {}'.format(col2.iloc[len(col1) - 1], col1.iloc[len(
        col1) - 1])
    items.append(s)
    items.append('0.0')
    return 'piecewise({})'.format(', '.join(items))
