The technique of resmapling is illustrated using a time series on chemical concentration readings taken every two hours between 1st January 1975 and 17th January 1975. The dataset has been downloaded from http://datamarket.com and is also available in the datasets folder of this book's GitHub repo.
We start by importing the packages required for running this example:
from __future__ import print_function import os import pandas as pd import numpy as np %matplotlib inline from matplotlib import pyplot as plt
Then we set the working directory as follows:
os.chdir('D:/Practical Time Series')
This is followed by reading the data from the CSV file in a pandas.DataFrame
and displaying shape and the first 10 rows of the DataFrame
:
df = pd.read_csv('datasets/chemical-concentration-readings.csv') print('Shape of the dataset:', df.shape) df.head(10)
The preceding code returns the following output:
Shape of the dataset: (197, 2)
Timestamp | Chemical conc. | |
0 | 1975-01-01 00:00... |