Challenge: Visualizing Time Series Components
Swipe to start coding
Your goal is to decompose a time series into its components — trend, seasonality, and residuals — using the seasonal_decompose() function from statsmodels.
- Load the built-in "flights" dataset from seaborn.
- Extract the
"passengers"column as your target time series. - Apply
seasonal_decompose()with an additive model and a period of 12 (months). - Store the result in a variable called
decomposition. - Plot the original series, trend, seasonal, and residual components.
seasonal_decompose(series, model="additive", period=12)
automatically splits the time series into four parts:
trend→ long-term movement;seasonal→ repeating patterns;resid→ random noise;observed→ original data.
Each component can be accessed with attributes like .trend, .seasonal, .resid.
Рішення
Дякуємо за ваш відгук!
single
Запитати АІ
Запитати АІ
Запитайте про що завгодно або спробуйте одне із запропонованих запитань, щоб почати наш чат
Awesome!
Completion rate improved to 6.67
Challenge: Visualizing Time Series Components
Свайпніть щоб показати меню
Swipe to start coding
Your goal is to decompose a time series into its components — trend, seasonality, and residuals — using the seasonal_decompose() function from statsmodels.
- Load the built-in "flights" dataset from seaborn.
- Extract the
"passengers"column as your target time series. - Apply
seasonal_decompose()with an additive model and a period of 12 (months). - Store the result in a variable called
decomposition. - Plot the original series, trend, seasonal, and residual components.
seasonal_decompose(series, model="additive", period=12)
automatically splits the time series into four parts:
trend→ long-term movement;seasonal→ repeating patterns;resid→ random noise;observed→ original data.
Each component can be accessed with attributes like .trend, .seasonal, .resid.
Рішення
Дякуємо за ваш відгук!
single