How it works...
In this recipe, we determined the time between energy records and then the time between specific events, such as the local maxima of a time series, using the Appliances energy prediction dataset.
We loaded the data and used pandas to_datetime() to change the format of the date variable so that it was a datetime variable. Next, we used pandas diff() to determine the difference in the datetime values between one row and its immediate precedent row, which returned the time between energy records.
Next, we extracted the day and month from the datetime variable. By using pandas groupby() over these features, followed by pandas mean(), we created a time series with the mean energy consumed daily by appliances. Next, we used find_peaks() ...
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