Representing durations of time using Period
Many useful analysis operations on time-series data require that events within a specific time interval be analyzed. A simple example would be to determine how many financial transactions occurred in a specific period.
These types of analyses can be performed using Timestamp
and DateOffset
, where the bounds are calculated and then items filtered based on these bounds. However, this becomes cumbersome when you need to deal with events that must be grouped into multiple periods of time, as you start to need to manage sets of the Timestamp
and DateOffset
objects.
To facilitate these types of data organization and calculations, pandas makes intervals of time a formal construct using the Period
class. pandas also formalizes series of Period
objects using PeriodIndex
, which provides capabilities of aligning data items based on the indexes associated period objects.
Modelling an interval of time with a Period
pandas formalizes the concept of an interval of...