Guides

Business Days in Python: numpy, pandas, holidays, or an API?

numpy

import numpy as np
np.busday_offset("2026-11-25", 2, roll="forward", holidays=["2026-11-26"])  # 2026-11-30

Fast, but you supply the holiday list yourself, and it's easy to get the list wrong.

pandas

import pandas as pd
from pandas.tseries.holiday import USFederalHolidayCalendar
bday = pd.offsets.CustomBusinessDay(calendar=USFederalHolidayCalendar())
pd.Timestamp("2026-11-25") + 2 * bday

Watch out: USFederalHolidayCalendar models federal-government holidays. It doesn't apply the Federal Reserve's Saturday rule, so it's wrong for ACH and wires in years where a holiday falls on Saturday.

The holidays package

import holidays
us = holidays.financial_holidays("NYSE")
"2026-04-03" in us  # Good Friday -> True

Excellent data (Bankday's exchange and country calendars build on it), but it is a dependency you must keep updated in every service, and it doesn't do business-day arithmetic, payment rails or FX rules.

The API

import os, requests
r = requests.get("https://bankday.jacklehoff4866.workers.dev/v1/business-days/add",
                 params={"calendar": "us-fed", "date": "2026-11-25", "days": 2},
                 headers={"Authorization": f"Bearer {os.environ['BANKDAY_KEY']}"})
r.json()["result"]  # '2026-11-30'

One HTTPS call, centrally updated, the same answer in every service and language.

Get a free API key

1,000 requests/month free. No credit card. Your key appears instantly.