Let's begin by importing the libraries and getting the dataset ready:
- First, we'll import pandas:
import pandas as pd
- Now, we'll load three variables from the Appliances energy prediction dataset: the date and time in which the energy consumption was recorded and the energy that's consumed by appliances and lights:
cols = ['date', 'Appliances', 'lights']data = pd.read_csv('energydata_complete.csv', usecols=cols)
- At the moment, the data type of the date variable is an object. Let's change it so that it's a datetime:
data['date'] = pd.to_datetime(data['date'])
- Let's create some new features that capture the average energy consumption by appliances and lights in the last 60 minutes, where six observations cover the 60 ...