Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Apprendre Challenge: Visualizing Time Series Components | Foundations of Time Series Analysis
Time Series Forecasting with ARIMA

bookChallenge: Visualizing Time Series Components

Tâche

Swipe to start coding

Your goal is to decompose a time series into its componentstrend, seasonality, and residuals — using the seasonal_decompose() function from statsmodels.

  1. Load the built-in "flights" dataset from seaborn.
  2. Extract the "passengers" column as your target time series.
  3. Apply seasonal_decompose() with an additive model and a period of 12 (months).
  4. Store the result in a variable called decomposition.
  5. 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.

Solution

Tout était clair ?

Comment pouvons-nous l'améliorer ?

Merci pour vos commentaires !

Section 1. Chapitre 4
single

single

Demandez à l'IA

expand

Demandez à l'IA

ChatGPT

Posez n'importe quelle question ou essayez l'une des questions suggérées pour commencer notre discussion

close

Awesome!

Completion rate improved to 6.67

bookChallenge: Visualizing Time Series Components

Glissez pour afficher le menu

Tâche

Swipe to start coding

Your goal is to decompose a time series into its componentstrend, seasonality, and residuals — using the seasonal_decompose() function from statsmodels.

  1. Load the built-in "flights" dataset from seaborn.
  2. Extract the "passengers" column as your target time series.
  3. Apply seasonal_decompose() with an additive model and a period of 12 (months).
  4. Store the result in a variable called decomposition.
  5. 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.

Solution

Switch to desktopPassez à un bureau pour une pratique réelleContinuez d'où vous êtes en utilisant l'une des options ci-dessous
Tout était clair ?

Comment pouvons-nous l'améliorer ?

Merci pour vos commentaires !

Section 1. Chapitre 4
single

single

some-alt