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./blob/main/code/Ch14/Chapter%2014.ipynb
- Datasets: https://github.com/PacktPublishing/Time-Series-Analysis-with-Python-Cookbook./tree/main/datasets/Ch14
You can install PyOD with either pip
or Conda. For a pip
install, run the following command:
pip install pyod
For a Conda
install, run the following command:
conda install -c conda-forge pyod
To prepare for the outlier detection recipes, start by loading the libraries that you will be using throughout the chapter:
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from pathlib import Path
import warnings
warnings.filterwarnings('ignore')
plt.rcParams["figure.figsize"] = [16, 3]
Load the nyc_taxi.csv
data into a pandas DataFrame as it will be used throughout the chapter:
file = Path(...