Business Hours

Discover how to handle business hours in time series data.

Introduction

Let’s go one step beyond business days and look at the more granular component of business hours. As an extension to the concept of business days, business hours refer to the operating hours of a business day.

This concept of business hours is important when performing operations that need to respect a business’ specific hours of operation. For instance, if we analyze hourly sales data for a business and want to calculate the total sales for each business day, we would want to exclude data outside the business hours.

By default, the business hours in pandas are defined as Monday–Friday, 9 AM to 5 PM, excluding holidays.

The BusinessHour offset

To discuss business hour representations, we’ll need to work with DateOffset objects in pandas. In particular, the BusinessHour() class provides a business hour representation on the BusinessDay, and also allows us to set specific start and end times.

Get hands-on with 1400+ tech skills courses.