Time Series • Time Series Analysis and Components
Time Series / P2.02 Time Series Plot with EDA

P2.02 Time Series Plot with EDA

Practical 2 Time Series Analysis and Components

Perform Kaggle-style inspection of a 36-month constructed passenger-like series, then draw a time plot and comment on trend and seasonality.

Practical / Solution

P2.02 Time Series Plot with EDA

Problem Statement

Perform Kaggle-style inspection of a 36-month constructed passenger-like series, then draw a time plot and comment on trend and seasonality.

Learning Outcomes

  • Inspect shape, dtypes, missing values and summary stats.
  • Plot the series and describe trend/seasonality in words.

Theory

A time series plot is the standard graph of observations against time. For monthly data, repeating peaks in the same months suggest seasonality.

Dataset / Data Source

Constructed 36 monthly passenger-like counts with trend and a 12-month bump. Teaching series inspired by classic airline-passenger examples, not downloaded from a website.

Kaggle-style Workflow

  • Load and inspect
  • Check missing values and describe()
  • Time plot
  • Optional month-wise box view
  • Interpretation

Analysis / Program

import pandas as pd import numpy as np import matplotlib.pyplot as plt idx = pd.date_range("2023-01-01", periods=36, freq="MS") trend = np.linspace(100, 160, 36) season = 12 * np.sin(2 * np.pi * idx.month / 12) rng = np.random.default_rng(1) ts = pd.Series(trend + season + rng.normal(0, 2, 36), index=idx, name="passengers") print(ts.shape, ts.dtype, ts.isna().sum()) print(ts.describe()) ts.plot(title="Monthly passenger-like series") plt.tight_layout() plt.show()

Expected Output

Printed shape, dtype, missing count, descriptive statistics and a 36-month line chart with a rise and a repeating wave. Random noise uses a fixed seed so your local run should match this construction, but do not treat printed means as official exam constants.

Result / Interpretation

EDA confirms a regular monthly index and no missing values. The plot shows long-term increase plus a seasonal wave. That is enough to justify later seasonal thinking in Unit 3, without fitting SARIMA yet.

Note

Plot the data before choosing a model.