statsmodels.tsa.tsatools.detrend¶
- statsmodels.tsa.tsatools.detrend(x, order=1, axis=0)[source]¶
Detrend an array with a trend of given order along axis 0 or 1.
- Parameters:
- xarray_like, 1d or 2d
Data, if 2d, then each row or column is independently detrended with the same trendorder, but independent trend estimates.
- order
int
The polynomial order of the trend, zero is constant, one is linear trend, two is quadratic trend.
- axis
int
Axis can be either 0, observations by rows, or 1, observations by columns.
- Returns:
ndarray
The detrended series is the residual of the linear regression of the data on the trend of given order.