Time-Series Modelling with Python

Time-Series Modelling with Python icon

Time-Series Modelling with Python

About This Course

A time series is not an ordinary table of observations. Each value depends on the ones before it, so the usual tools for cleaning, validating and modelling data give misleading answers if they are applied without change. This course teaches you to handle time-stamped data correctly in Python and to build forecasts you can defend.

Day one is about the data. Most of the work in a time-series project happens before any model is fitted: dates that parse differently depending on the locale, readings taken at irregular intervals, series from two instruments whose timestamps never quite line up, and gaps that need filling without inventing a trend. You do this in Pandas, and plot the results with Plotly so that seasonality and anomalies are visible before you try to model them.

Day two builds the models. You start with a baseline and with the classical statistical approach in statsmodels — checking stationarity, reading autocorrelation plots, fitting ARIMA-family models and testing whether their residuals support the fit — then model changing volatility with GARCH. From there we compare automated tools, pmdarima, Prophet and Darts, against what you built by hand, and treat forecasting as a machine learning problem with scikit-learn. Throughout, models are judged on time-ordered validation: a random train/test split lets a model see the future, and reports an accuracy it cannot reproduce. Darts also supports neural network forecasting models; we point you to them, but deep learning is not covered in this course.

Bring your own datasets and we will work through them with you. Our trainers build models like these in their own work, so an unfamiliar series or an awkward sampling scheme gets solved in the room. You should leave able to take a raw time series from loading to a validated forecast, and to explain why the model you chose is the right one for that data.

Who This Course Is For

Analysts, scientists, engineers and finance staff whose data arrives as measurements over time: sensor and instrument readings, hydrological and climate records, prices and returns, demand and usage figures. It suits people who have outgrown a spreadsheet trend line or a single moving average, and need a forecast whose assumptions they can check.

It also suits teams that produce forecasts other people plan around, and want a shared, defensible way of building and validating them rather than a method that lives in one person's notebook.

Prerequisites

This course is designed to be able to be completed immediately after completing Python Charmers' Introduction to Python course, or equivalent programming experience (approximately 3 months of regular usage).

You should be comfortable loading and filtering data in Pandas. No prior time-series or forecasting experience is assumed: the statistics the models rely on, such as stationarity tests, autocorrelation and information criteria, are introduced as they are needed.

What You'll Learn

  • Load, clean and align time-stamped data from several sources, including series recorded at different frequencies or in different timezones.
  • Resample, smooth and plot a series to expose its trend, seasonality and anomalies before modelling it.
  • Test a series for stationarity and use autocorrelation plots to choose a model's order.
  • Fit and compare ARIMA-family and GARCH models, and check the residuals to confirm the model fits.
  • Evaluate a forecast against a baseline using time-ordered validation rather than a random split.
  • Save a fitted model so it can produce forecasts outside the notebook it was built in.

Course Syllabus

Day 1 — Working with time-series data

  • Parsing dates reliably, timestamp resolution, and handling timezones
  • Indexing, resampling and frequency conversion with timestamps and periods
  • Rolling, expanding and exponentially weighted windows
  • Business-day calendars, and grouping by time alongside other keys
  • Joining series whose timestamps do not match, with merge_asof
  • Missing and abnormal values: filling, interpolation, and limiting how far a fill reaches
  • Visualising time series: seasonal plots, heat maps, differencing and the frequency spectrum
  • Interactive charts with Plotly, including series with millions of points

Day 2 — Modelling and forecasting

  • Decomposing a series into trend, seasonality and residual, and setting a baseline to beat
  • Stationarity, differencing and the augmented Dickey-Fuller test
  • Autocorrelation and partial autocorrelation for choosing a model order
  • AR, MA, ARMA and seasonal ARIMA models in statsmodels, compared by AIC and checked with residual diagnostics
  • Modelling volatility with GARCH
  • Automated model selection and probabilistic forecasts with pmdarima, Prophet and Darts
  • Non-linear and machine learning models, with time-ordered cross-validation
  • Putting a forecasting model into production