In the previous recipes, we performed mathematical operations over the values of the time series to obtain new features that summarize information about the variable, such as the mean and maximum values or the cumulative sum. It is also possible to perform these mathematical operations over the time-stamp and obtain information about the time between transactions or the time between specific events.
In this recipe, we will calculate the time between transactions, that is, the time between successive records of the variable values. Then, we will determine the time between specific events, such as the time between peaks of energy consumption, to demonstrate the power of pandas when it comes to aggregating time series data.