def _make_lag_matrix(x, lags):
    data = {}
    columns = []
    for i in range(1, 1 + lags):
        lagstr = 'L%d.'% i
        lag = x.shift(i).rename(columns=lambda c: lagstr + c)
        data.update(lag._series)
        columns.extend(lag.columns)

    return pd.DataFrame(data, columns=columns)
dataset/ETHPy150Open statsmodels/statsmodels/statsmodels/tsa/vector_ar/dynamic.py/_make_lag_matrix/original