python-bizdays
bizdays computes business days with holiday calendars. This README covers
bizdays 2.0, which runs on Python 3.10 to 3.14 with NumPy 1.24 or newer and
pandas 2 or 3. bizdays.Calendar accepts single dates, Python sequences,
NumPy arrays and pandas date-like inputs, and returns NumPy scalars or arrays.
Install
pip install bizdays
Install the optional integrations with:
pip install "bizdays[pmc]"
pip install "bizdays[xcal]"
pip install "bizdays[work]"
Quickstart
>>> from bizdays import Calendar
>>> cal = Calendar.load(name="ANBIMA")
>>> cal.bizdays("2014-01-13", "2015-01-13")
np.float64(253.0)
>>> cal.following("2015-12-25")
np.datetime64('2015-12-28')
>>> cal.offset(["2014-01-02", "2014-01-03"], [1, 5])
array(['2014-01-03', '2014-01-10'], dtype='datetime64[D]')
>>> cal.seq("2014-01-02", "2014-01-07")
array(['2014-01-02', '2014-01-03', '2014-01-06', '2014-01-07'],
dtype='datetime64[D]')
>>> cal.getdate("15th day", "2002-05")
np.datetime64('2002-05-15')
>>> cal.getbizdays(2024)
np.float64(253.0)
Calendars that come with the package
ANBIMA: 2000-01-01 to 2099-12-25. Official ANBIMA holidays up to 2079; later years are projected with the national holiday rule.B3: official B3 holidays for 2000-2026. Years 2027-2099 are projected: ANBIMA holidays, plus December 24, plus the last weekday of the year. Projected years are replaced when B3 publishes them.Actual: no holidays, every day is a business day; 1900-01-01 to 2199-12-31.
You can list them with list_calendars():
>>> from bizdays import list_calendars
>>> list_calendars()["packaged"]
['ANBIMA', 'B3', 'Actual']
Use Calendar.load(name="...") for packaged calendars and
Calendar.load(filename="...") for custom JSON calendar files.
External providers are also available through prefixed names:
Calendar.load(name="PMC/<calendar>")forpandas_market_calendarsCalendar.load(name="XCAL/<calendar>")forexchange_calendarsCalendar.load(name="WORK/<code>")forworkalendar
Create a calendar from scratch
>>> custom = Calendar(
... holidays=["2024-01-01", "2024-12-25"],
... weekdays=["Saturday", "Sunday"],
... startdate="2024-01-01",
... enddate="2024-12-31",
... name="Example",
... )
>>> custom.bizdays("2024-12-20", "2024-12-31")
np.float64(6.0)
JSON calendar layout
Calendar.load(filename="...") expects a JSON object with these fields:
name: stringweekdays: list of weekday namesholidays: list of ISO date stringsfinancial: booleanstart.dateandend.date: optional ISO date strings (YYYY-MM-DD) that setstartdateandenddate; a bad value raisesValueErroradjust.fromandadjust.to: optional; only the defaults"following"and"preceding"are accepted, and other values raiseValueError
Example:
{
"name": "Custom",
"weekdays": ["saturday", "sunday"],
"holidays": ["2024-01-01", "2024-12-25"],
"financial": true,
"start.date": "2024-01-01",
"end.date": "2024-12-31"
}
API notes
- packaged calendars:
ANBIMA,B3, andActual PMC/...names require the optionalbizdays[pmc]extraXCAL/...names require the optionalbizdays[xcal]extraWORK/...names require the optionalbizdays[work]extraCalendarmethods return NumPy values such asnumpy.datetime64,numpy.float64counts (NaNfor missing),numpy.ndarray, and masked arrays forisbizdayvectors (fill_value=False)- results are positional NumPy values: assign them to a DataFrame column, and
give
index=if you wrap them in a pandas Series; see the API reference - pandas timestamps, indexes, and series can be passed directly to the public API
Documentation
Metadata
Release files for bizdays 2.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| bizdays-2.0.0.tar.gz | 96.1 kB | With provenance | Details for bizdays-2.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| bizdays-2.0.0-py3-none-any.whl | Python 3 | none | any | Details for bizdays-2.0.0-py3-none-any.whl |
Total release size: 131.0 kB
Release files / bizdays-2.0.0.tar.gz
| Download URL | bizdays-2.0.0.tar.gz |
|---|---|
| Size | 96.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
da2a57bbcad22f72fb5b877b15bf9827f62243eff049123d5094cfca41ce7ac0
|
|
BLAKE2b-256 checksum How to use checksums |
7848d9c8850cb390b41f418ad403f0c64f1ff3cec9371b5ec3fe2205a32befd7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 8, 2026.
Transparency logRelease files / bizdays-2.0.0-py3-none-any.whl
| Download URL | bizdays-2.0.0-py3-none-any.whl |
|---|---|
| Size | 34.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ae5fb8f0f4e77d74098fae8ef0e43b5b7f61fac8a8b59567f42b17939cf1cd28
|
|
BLAKE2b-256 checksum How to use checksums |
962e49d4586585b0009812711cb4d8bfa80c0ff0e85f37f2071e4735b42c1cc4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 8, 2026.
Transparency logSecurity for bizdays 2.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for bizdays-2.0.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 8, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.