Open-source project
PacktPublishing/Modern-Time-Series-Forecasting-with-Python avatar
PacktPublishing/Modern-Time-Series-Forecasting-with-Python

Modern Time Series Forecasting with Python: the code behind the book

Modern Time Series Forecasting with Python, published by Packt

564 stars283 forksJupyter NotebookMIT

At a glance

What is it?
This repository is the code for a Packt book on time series forecasting, and its real interest is the sequence it teaches, classical ARIMA baselines first, then forecasting cast as regression, then feature engineering, ensembling, and finally the deep learning architectures, all as runnable notebooks.
Who is it for?
This repository fits a reader working through the book alongside the text, since the environment file and the installation check script remove the usual first afternoon of dependency wrangling, and it fits an experienced practitioner who wants to see the modern architectures in runnable form.
Can I use it commercially?
Yes. MIT is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
Is it still maintained?
Activity is slowing. The repository last received commits 6 months ago.
What is it written in?
Mainly Jupyter Notebook, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on October 23, 2026, and from our analysis. They are not legal advice.

Editorial analysis

A book repository, and what that means for the code

This is the code repository for Modern Time Series Forecasting with Python, published by Packt, and the primary language is listed as Jupyter Notebook, which tells you the shape of the thing. The code is organised into folders, and the content is mostly notebooks that accompany the chapters rather than a library you import. That distinction matters if you are evaluating it as a codebase, because a book repository is judged by whether the examples run and read clearly, and it is not judged by whether the API is stable or the package is installable. The repository carries a src/ directory, notebooks/, a scripts/ directory, an anaconda_env.yml, a test_installation.py, a test_data_download.py, an ERRATA.md and a .vscode/ directory. The last push to the repository was on 2026-04-22, and the project publishes no GitHub releases.

The teaching sequence, from ARIMA to deep learning

The feature list in the overview describes a deliberate order, and the order is the argument. The book positions itself as taking you beyond commonly used classical statistical methods such as ARIMA, and the listed topics read as a progression. It starts with manipulating and visualising time series data, then setting strong baselines with popular models such as ARIMA. From there it shows how time series forecasting can be cast as regression, and then covers engineering features for machine learning models for forecasting, the world of ensembling and stacking models, and the global forecasting paradigm. The last technical step is the deep learning layer, with state-of-the-art models such as N-BEATS and Autoformer, followed by multi-step forecasting and cross-validation strategies. The framing of the book is industry-tested tips and tricks, and the code is presented as an example of the code looking like the following.

What is in a notebook, concretely

The overview shows one fragment of what the code looks like, and it is worth reading because it shows the house style. The example is a seasonal decomposition with a comment explaining a data handling decision.

code
#Does not support missing values, so using imputed ts instead
res = seasonal_decompose(ts, period=7*48, model="additive",
extrapolate_trend="freq")

The period of 7 times 48 is a week of half-hourly observations, which tells you the examples work on intraday data, and the comment about missing values tells you the author is explicit about the constraints of the function being called. That combination, a realistic period and a stated limitation, is a reasonable signal about the quality of the examples, though it is one fragment rather than a survey of the notebooks.

Setting up the environment, and checking it

The recommended way to set up is with Anaconda, or Miniconda if you do not want the pre-installed packages that come with Anaconda. The steps are laid out in order. Install Anaconda or Miniconda, then open the conda prompt, which on Windows means the Anaconda Prompt from the Start menu, and on macOS and Linux a terminal where you type conda activate. Then navigate to the downloaded code with the cd command, and install the environment using the included anaconda_env.yml file with conda env create and the file flag.

The environment is created under the name modern_ts and installs all the required libraries, and the overview warns that this can take a while. The next step is the one that saves time later, checking the installation by running a script in the downloaded code folder, test_installation.py, which verifies the libraries the book needs are present. The repository also ships test_data_download.py, so the datasets the notebooks expect are fetched rather than committed.

Running the notebooks, and the activation rule

Every time you want to run the notebooks, you first activate the environment with conda activate modern_ts, and then start either Jupyter Notebook with jupyter notebook or Jupyter Lab with jupyter lab, depending on your preference. The emphasis on every time is not incidental, and the practical consequence is that a fresh terminal without the activation will fail on the first import. The setup section also covers a failure mode that will otherwise cost you an hour. Sometimes the Anaconda installation stalls at the Solving Environment stage, because Anaconda can be really slow at resolving package dependencies, and the overview starts to explain the workaround before the excerpt ends. The advice to use Miniconda as a lighter alternative to the full Anaconda distribution is in the same spirit.

Who the book is written for

The audience is described in two passes. The book is for data scientists, data analysts, machine learning engineers and Python developers who want to build industry-ready time series models, and since it explains most concepts from the ground up, basic proficiency in Python is all that is needed, with prior understanding of machine learning or forecasting helping to speed up the learning. For experienced practitioners, the book is said to have a lot to offer in terms of advanced techniques and traversing the latest research frontiers in time series forecasting. The distinction is a reasonable guide to how you should read it. A beginner reading the ARIMA chapter gets the foundational treatment, and an experienced forecaster reading the same chapter is there for the specific choices the authors made when setting the baseline.

What this repository is not

Two things are worth being clear about. First, there is no package to install and no API to call, so if your goal is to add forecasting to a product, this is not where you start. The repository is example code with the surrounding apparatus of a book, including the errata file and the environment file, and its value is in the examples rather than in the code as a dependency. Second, the results in the notebooks are tied to the datasets the scripts download, so a reader reproducing the numbers needs those datasets, and the multi-step forecasting and global forecasting chapters in particular depend on the specific data setup the authors chose. Nothing in the repository suggests the code is tested as a library, and nothing suggests it is meant to be.

Editorial conclusion

This repository fits a reader working through the book alongside the text, since the environment file and the installation check script remove the usual first afternoon of dependency wrangling, and it fits an experienced practitioner who wants to see the modern architectures in runnable form. It does not fit someone looking for a forecasting library to depend on, because this is example code for a book rather than a maintained package, and it does not fit a reader who wants a self-contained reference, since the explanations live in the book itself. Before you start, build the conda environment from the included file and run the installation check script, and note that the notebooks assume the environment is active every time, so a fresh shell without the activation will fail on the first import.

Frequently asked questions

What does the Modern Time Series Forecasting with Python repository contain?

It is the code for the Packt book, with the primary language being Jupyter Notebook. The top level holds notebooks/, src/, scripts/, an anaconda_env.yml environment file, a test_installation.py check script, a test_data_download.py script for the datasets, and an ERRATA.md file.

How do I set up the environment for the book?

Install Anaconda or the lighter Miniconda, open the conda prompt, change into the downloaded code directory, and create the environment from the included anaconda_env.yml with conda env create and the file flag. That creates an environment named modern_ts, and the overview notes it can take a while to resolve.

How do I check that everything installed correctly?

Run the test_installation.py script included in the downloaded code folder. It checks whether all the libraries required for the book are installed properly, before you start running notebooks.

Which forecasting methods does the book cover?

The progression runs from manipulating and visualising time series data through strong baselines with models such as ARIMA, casting forecasting as regression, feature engineering for machine learning models, ensembling and stacking, the global forecasting paradigm, deep learning models such as N-BEATS and Autoformer, and multi-step forecasting with cross-validation strategies.

Official sources

  1. Issues
  2. License: MIT
  3. PacktPublishing/Modern-Time-Series-Forecasting-with-Python on GitHub
  4. README
Add this badge to your README

If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.

Add this badge to your README

markdown
[![Hysen Labs](https://hysenlabs.com/badge/packtpublishing-modern-time-series-forecasting-with-python.svg)](https://hysenlabs.com/projects/packtpublishing-modern-time-series-forecasting-with-python)

Was this useful?