Business Dates and Holidays

Discover how to work effectively with business dates and holidays in time series data.

Introduction

When learning about time series data, it’s crucial to understand how to handle business days. So far, we’ve been focusing on calendar days when working with time series data.

On the other hand, a business day refers only to days when businesses are typically operating. This usually includes weekdays (Monday through Friday) and excludes weekends and public holidays. Business days are important for various purposes, such as calculating deadlines and processing shipping times.

Generating business date ranges

There are two ways to generate business dates. The most direct way is to use the bdate_range() function, which returns a fixed frequency DatetimeIndex with the business day as the default frequency (i.e., string alias B).

For example, we can generate a set of business dates for the first 13 weeks (representing the first quarter) of the financial year of 2023, as shown below:

Get hands-on with 1200+ tech skills courses.