How to do it...

Let's begin by importing the libraries and getting the data set ready:

  1. Let's import the required libraries and function:
import numpy as npimport pandas as pd
import matplotlib.pyplot as pltfrom scipy.signal import find_peaks
  1. Let's load the Appliances energy prediction dataset:
data = pd.read_csv('energydata_complete.csv')
  1. The data type of the date variable is object; let's change it to datetime:
data['date'] = pd.to_datetime(data['date'])
  1. Now, we need to extract the day, month, and hour part from the datetime variable into new columns:
data[['day', 'month', 'hr']] = pd.DataFrame([(x.day, x.month, x.hour) for x in data['date']])
We discussed the code in the preceding step in the Deriving representations of year and ...

Get Python Feature Engineering Cookbook now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.