What is a time series?
A time series is a sequence of observations collected over time, usually at regular intervals.
Examples include:
- Daily call-center volume
- Monthly sales
- Hourly electricity demand
- Annual unemployment rates
Creating a time series in Python
Let’s create a simple example using pandas.
import pandas as pd
import matplotlib.pyplot as plt
dates = pd.date_range(
start="2026-01-01",
periods=30,
freq="D"
)
volume = pd.Series(
range(100, 130),
index=dates,
name="volume"
)
volume.plot(title="Example Daily Volume")
plt.xlabel("Date")
plt.ylabel("Volume")
plt.show()
This example creates 30 daily observations and plots them over time.
Why does time order matter?
Unlike ordinary independent observations, time-series data can contain trends, seasonality, and serial dependence.
Understanding these patterns helps us select appropriate forecasting methods.