Logo

statsmodels.tsa.tsatools.add_constant

statsmodels.tsa.tsatools.add_constant(data, prepend=False)

This appends a column of ones to an array if prepend==False.

For ndarrays and pandas.DataFrames, checks to make sure a constant is not already included. If there is at least one column of ones then the original object is returned. Does not check for a constant if a structured or recarray is given.

Parameters :

data : array-like

data is the column-ordered design matrix

prepend : bool

True and the constant is prepended rather than appended.

Returns :

data : array

The original array with a constant (column of ones) as the first or last column.

Notes

Warning

The default of prepend will be changed to True in the next release of statsmodels. We recommend to use an explicit prepend in any permanent code.

Previous topic

statsmodels.tsa.filters.filtertools.fftconvolveinv

Next topic

statsmodels.tsa.tsatools.add_trend

This Page