Representing data intervals with date offsets

DatetimeIndex objects are created at various frequencies by using passing frequency strings such as 'M', 'W', and 'BM' using the freq parameter of pd.date_range(). Under the hood, these frequency strings are translated into an instance of the pandas DateOffset object.

A DateOffset represents a regular frequency increment. Specific date offset logic, such as "month", "business day", or "hour", is represented in pandas with various subclasses of DateOffset. A DateOffset provides pandas with the intelligence to be able to determine how to calculate a specific interval of time from a reference date and time. This provides the user of pandas much greater flexibility in representing date/time offsets ...

Get Learning pandas - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.