@staticmethod
def formula_constant(col1, col2):
    """ Constant value between data points
        piecewise x1, y1, [x2, y2, ][...][z]
        A piecewise function: if (y1), x1.Otherwise, if (y2), x2, etc.Otherwise, z.
        :return:
        :rtype:
        """
    items = []
    s = '{}, time < {}'.format(col2.iloc[0], col1.iloc[0])
    items.append(s)
    for k in range(len(col1) - 1):
        condition = 'time >= {} && time < {}'.format(col1.iloc[k], col1.
            iloc[k + 1])
        formula = '{}'.format(col2.iloc[k])
        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))
