How it works...
In this recipe, we created new features that summarize the information that occurred in a certain temporal window by using the Appliances energy prediction time series dataset.
First, we loaded the columns with the date of the energy consumption record and the energy that's consumed by appliances and lights into a pandas dataframe. The dataset contained records of energy consumption at regular 10 minute intervals.
To determine the mean energy that was consumed in the previous hour, we used pandas rolling(), followed by pandas mean(). The energy consumption is recorded every 10 minutes; this means that six observations span one hour of energy consumption. Thus, we specified six to the window argument of pandas rolling(). The ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access