From the course: Python for Time Series Forecasting

Unlock this course with a free trial

Join today to access over 24,800 courses taught by industry experts.

Build DataFrame of components

Build DataFrame of components - Python Tutorial

From the course: Python for Time Series Forecasting

Build DataFrame of components

- [Instructor] To represent these components in the Plotly interactive chart, we must go back up and apply the mathematical calculations. In the results from the function seasonal_decompose, we can access each one of the components with the dot notation to get the residual, and we get some missing values, but only at the beginning and end. Why? Because if we get all of the values, we see that there are only six values at the beginning, which are missing, and then six values at the end. Why is this happening? Because to compute the trend, we must calculate on this date the average between the six past values and the six following ones. So if we are here, we don't have six values prior. It is not until this date where we have six values before, which is the reason why it's starting here. Now, why six? Because in our seasonal_decompose function, which is extrapolating the period based on the frequency of the data, in our case is monthly therefore the value would be 12, it means that…

Contents