Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Time Series Analysis with Python Cookbook
Time Series Analysis with Python Cookbook

Time Series Analysis with Python Cookbook: Practical recipes for exploratory data analysis, data preparation, forecasting, and model evaluation , Second Edition

Arrow left icon
Profile Icon Tarek A. Atwan
Arrow right icon
Early Access Early Access Publishing in Jan 2026
R$80 R$222.99
eBook Jan 2026 98 pages 2nd Edition
eBook
R$80 R$222.99
Paperback
R$278.99
Subscription
Free Trial
Renews at $19.99p/m
Arrow left icon
Profile Icon Tarek A. Atwan
Arrow right icon
Early Access Early Access Publishing in Jan 2026
R$80 R$222.99
eBook Jan 2026 98 pages 2nd Edition
eBook
R$80 R$222.99
Paperback
R$278.99
Subscription
Free Trial
Renews at $19.99p/m
eBook
R$80 R$222.99
Paperback
R$278.99
Subscription
Free Trial
Renews at $19.99p/m

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Table of content icon View table of contents Preview book icon Preview Book

Time Series Analysis with Python Cookbook

Join our book community on Discord

https://packt.link/zmkOY

When embarking on a journey to learn coding in Python, you will often find yourself following instructions to install packages and import libraries, followed by a flow of a code-along stream. Yet an often-neglected part of any data analysis or data science process is ensuring that the right development environment is in place. Therefore, it is critical to have the proper foundation from the beginning to avoid any future hassles, such as an overcluttered implementation or package conflicts and dependency crisis. Having the right environment setup will serve you in the long run when you complete your project, ensuring you are ready to package your deliverable in a reproducible and production-ready manner.

Such a topic may not be as fun and may feel administratively heavy as opposed to diving into the core topic or the project at hand. But it is this foundation that differentiates a seasoned developer from the pack. Like any...

Technical requirements

In this chapter, you will be primarily using the command line. For macOS and Linux, this will be the default Terminal (bash or zsh), while on a Windows OS, you will use the Anaconda Prompt, which comes as part of the Anaconda or Miniconda installation. Installing Anaconda or Miniconda will be discussed in the following Getting ready section.

We will use Visual Studio Code for the IDE, which is available for free at https://code.visualstudio.com. It supports Linux, Windows, and macOS.

Other valid alternative options that will allow you to follow along include the following:

The source code for this chapter is available at https://github.com/PacktPublishing/Time-Series-Analysis-with-Python-Cookbook

Development environment setup

As we dive into the various recipes provided in this book, you will be creating different Python virtual environments to install all your dependencies without impacting other Python projects.

You can think of a virtual environment as isolated buckets or folders, each with a Python interpreter and associated libraries. The following diagram illustrates the concept behind isolated, self-contained virtual environments, each with a different Python interpreter and different versions of packages and libraries installed:

Figure 1.1: An example of three different Python virtual environments, one for each Python project

If you installed Anaconda then these environments are typically stored and contained in separate folders inside the envs subfolder within the main Anaconda (or Miniconda) folder installation. As an example, on macOS, you can find the envs folder under Users/<yourusername>/opt/anaconda3/envs/. On Windows OS, it may look more like C:\Users\...

Installing Python libraries

In the preceding recipe, you were introduced to the YAML environment configuration file, which allows you to create a Python virtual environment and all the necessary packages in one step using one line of code:

$ conda env create -f env.yml

Throughout this book, you will need to install several Python libraries to follow the recipes. There are several methods for installing Python libraries, which you will explore in this recipe.

Getting ready

You will create and use different files in this recipe, including a requirements.txt, environment_history.yml, and other files. These files are available to download from the GitHub repository for this book: https://github.com/PacktPublishing/Time-Series-Analysis-with-Python-Cookbook/tree/main/code/Ch1

In this chapter, you will become familiar with how to generate your requirements.txt file, as well as installing libraries in general.

How to do it…

The easiest way to install a collection of libraries at once...

Installing JupyterLab and JupyterLab extensions

Throughout this book, you can follow along using your favorite Python IDE (for example, PyCharm or Spyder) or text editor (for example, Visual Studio Code, Atom, or Sublime). There is another option based on the concept of notebooks that allows interactive learning through a web interface. More specifically, Jupyter Notebook or Jupyter Lab are the preferred methods for learning, experimenting, and following along with the recipes in this book. Interestingly, the name Jupyter is derived from the three programming languages: Julia, Python, and R. Alternatively, you can use Google's Colab, or Kaggle Notebooks. For more information, refer to the See also section from the Development environment setup recipe of this chapter. If you are not familiar with Jupyter Notebooks, you can get more information here: https://jupyter.org/.

In this recipe, you will install Jupyter Notebook, JupyterLab, and additional JupyterLab extensions.

Additionally...

Left arrow icon Right arrow icon

Key benefits

  • Explore up-to-date forecasting and anomaly detection techniques using statistical, machine learning, and deep learning algorithms
  • Learn different techniques for evaluating, diagnosing, and optimizing your models
  • Work with a variety of complex data with trends, multiple seasonal patterns, and irregularities

Description

To use time series data to your advantage, you need to be well-versed in data preparation, analysis, and forecasting. This fully updated second edition includes chapters on probabilistic models and signal processing techniques, as well as new content on transformers. Additionally, you will leverage popular libraries and their latest releases covering Pandas, Polars, Sktime, stats models, stats forecast, Darts, and Prophet for time series with new and relevant examples. You'll start by ingesting time series data from various sources and formats, and learn strategies for handling missing data, dealing with time zones and custom business days, and detecting anomalies using intuitive statistical methods. Further, you'll explore forecasting using classical statistical models (Holt-Winters, SARIMA, and VAR). Learn practical techniques for handling non-stationary data, using power transforms, ACF and PACF plots, and decomposing time series data with multiple seasonal patterns. Then we will move into more advanced topics such as building ML and DL models using TensorFlow and PyTorch, and explore probabilistic modeling techniques. In this part, you’ll also learn how to evaluate, compare, and optimize models, making sure that you finish this book well-versed in wrangling data with Python.

Who is this book for?

This book is for data analysts, business analysts, data scientists, data engineers, and Python developers who want practical Python recipes for time series analysis and forecasting techniques. Fundamental knowledge of Python programming is a prerequisite. Prior experience working with time series data to solve business problems will also help you to better utilize and apply the different recipes in this book.

What you will learn

  • Understand what makes time series data different from other data
  • Apply imputation and interpolation strategies to handle missing data
  • Implement an array of models for univariate and multivariate time series
  • Plot interactive time series visualizations using hvPlot
  • Explore state-space models and the unobserved components model (UCM)
  • Detect anomalies using statistical and machine learning methods
  • Forecast complex time series with multiple seasonal patterns
  • Use conformal prediction for constructing prediction intervals for time series

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Jan 23, 2026
Length: 98 pages
Edition : 2nd
Language : English
ISBN-13 : 9781805122999
Category :
Languages :
Concepts :

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Product Details

Publication date : Jan 23, 2026
Length: 98 pages
Edition : 2nd
Language : English
ISBN-13 : 9781805122999
Category :
Languages :
Concepts :

Packt Subscriptions

See our plans and pricing
Modal Close icon
$19.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
$199.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just $5 each
Feature tick icon Exclusive print discounts
$279.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just $5 each
Feature tick icon Exclusive print discounts

Table of Contents

13 Chapters
Time Series Analysis with Python Cookbook, Second Edition: Practical recipes for exploratory data analysis, data preparation, forecasting, and model evaluation Chevron down icon Chevron up icon
Chapter 1: Getting Started with Time Series Analysis Chevron down icon Chevron up icon
Chapter 2: Reading Time Series Data from Files Chevron down icon Chevron up icon
Chapter 3: Reading Time Series Data from Databases Chevron down icon Chevron up icon
Chapter 4: Persisting Time Series Data to Files Chevron down icon Chevron up icon
Chapter 5: Persisting Time Series Data to Databases Chevron down icon Chevron up icon
Chapter 6: Working with Date and Time in Python Chevron down icon Chevron up icon
Chapter 7: Handling Missing Data Chevron down icon Chevron up icon
Chapter 8: Outlier Detection Using Statistical Methods Chevron down icon Chevron up icon
Chapter 9: Exploratory Data Analysis and Diagnosis Chevron down icon Chevron up icon
Chapter 10: Building Univariate Time Series Models Using Statistical Methods Chevron down icon Chevron up icon
Chapter 11: Additional Statistical Modeling Techniques for Time Series Chevron down icon Chevron up icon
Chapter 12: Forecasting Using Supervised Machine Learning Chevron down icon Chevron up icon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

How do I buy and download an eBook? Chevron down icon Chevron up icon

Where there is an eBook version of a title available, you can buy it from the book details for that title. Add either the standalone eBook or the eBook and print book bundle to your shopping cart. Your eBook will show in your cart as a product on its own. After completing checkout and payment in the normal way, you will receive your receipt on the screen containing a link to a personalised PDF download file. This link will remain active for 30 days. You can download backup copies of the file by logging in to your account at any time.

If you already have Adobe reader installed, then clicking on the link will download and open the PDF file directly. If you don't, then save the PDF file on your machine and download the Reader to view it.

Please Note: Packt eBooks are non-returnable and non-refundable.

Packt eBook and Licensing When you buy an eBook from Packt Publishing, completing your purchase means you accept the terms of our licence agreement. Please read the full text of the agreement. In it we have tried to balance the need for the ebook to be usable for you the reader with our needs to protect the rights of us as Publishers and of our authors. In summary, the agreement says:

  • You may make copies of your eBook for your own use onto any machine
  • You may not pass copies of the eBook on to anyone else
How can I make a purchase on your website? Chevron down icon Chevron up icon

If you want to purchase a video course, eBook or Bundle (Print+eBook) please follow below steps:

  1. Register on our website using your email address and the password.
  2. Search for the title by name or ISBN using the search option.
  3. Select the title you want to purchase.
  4. Choose the format you wish to purchase the title in; if you order the Print Book, you get a free eBook copy of the same title. 
  5. Proceed with the checkout process (payment to be made using Credit Card, Debit Cart, or PayPal)
Where can I access support around an eBook? Chevron down icon Chevron up icon
  • If you experience a problem with using or installing Adobe Reader, the contact Adobe directly.
  • To view the errata for the book, see www.packtpub.com/support and view the pages for the title you have.
  • To view your account details or to download a new copy of the book go to www.packtpub.com/account
  • To contact us directly if a problem is not resolved, use www.packtpub.com/contact-us
What eBook formats do Packt support? Chevron down icon Chevron up icon

Our eBooks are currently available in a variety of formats such as PDF and ePubs. In the future, this may well change with trends and development in technology, but please note that our PDFs are not Adobe eBook Reader format, which has greater restrictions on security.

You will need to use Adobe Reader v9 or later in order to read Packt's PDF eBooks.

What are the benefits of eBooks? Chevron down icon Chevron up icon
  • You can get the information you need immediately
  • You can easily take them with you on a laptop
  • You can download them an unlimited number of times
  • You can print them out
  • They are copy-paste enabled
  • They are searchable
  • There is no password protection
  • They are lower price than print
  • They save resources and space
What is an eBook? Chevron down icon Chevron up icon

Packt eBooks are a complete electronic version of the print edition, available in PDF and ePub formats. Every piece of content down to the page numbering is the same. Because we save the costs of printing and shipping the book to you, we are able to offer eBooks at a lower cost than print editions.

When you have purchased an eBook, simply login to your account and click on the link in Your Download Area. We recommend you saving the file to your hard drive before opening it.

For optimal viewing of our eBooks, we recommend you download and install the free Adobe Reader version 9.

Modal Close icon
Modal Close icon