Technical requirements
You can download the Jupyter notebooks and datasets required from the GitHub repository:
- Jupyter notebooks: https://github.com/PacktPublishing/Time-Series-Analysis-with-Python-Cookbook-Second-Edition/blob/main/code/Ch13/Chapter_13.ipynb
- Datasets: https://github.com/PacktPublishing/Time-Series-Analysis-with-Python-Cookbook-Second-Edition/tree/main/datasets/Ch13
Creating a new Python environment when installing new libraries such as PyOD is always a good idea. If you need a quick refresher on creating a virtual Python environment, check out the Development environment setup recipe from Chapter 0 on GitHub. The chapter covers two methods: using conda and venv.
You can install PyOD with either pip or conda. For a pip install, run the following command:
pip install pyod
To prepare for the outlier detection recipes, start by loading the libraries that you will be using throughout the chapter:
import pandas as...