yearfrac
Daycount methods to compute date differences in year units
What it is and what it does
yearfrac is a Python library for computing the fractional number of years between two dates using standard financial daycount conventions. It implements methods like Actual/Actual ISDA, Actual/Actual AFB, 30E/360, and 30/365, which are commonly used in bond pricing, interest accrual, and other financial calculations. The package also provides utility functions for leap year detection, Easter Sunday calculation, and Julian Day number conversion.
The library has no external runtime dependencies and supports Python 3.6 and later. However, it has been abandoned since its latest release on 2023-02-06 with no active maintenance, meaning bugs and compatibility issues will not be addressed. It is suitable for projects that need basic daycount calculations but cannot rely on ongoing support or updates.
Use it for:
- Calculate accrued interest on bonds using ISDA or AFB daycount conventions.
- Compute year fractions for financial derivatives pricing and risk calculations.
- Convert between calendar dates and Julian Day numbers for astronomical or historical date work.
- Determine Easter Sunday dates for calendar or scheduling applications.
- Validate leap year status in date processing pipelines.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Computes fractional year differences between dates using various daycount conventions (Actual/Actual, 30/360, 30/365) and provides calendar utilities like leap year checks and Easter date calculation.
Yes, if you need standard daycount methods and can accept an unmaintained package. The library is stable for its narrow use case (no runtime dependencies, simple math), and the code is small enough to audit or fork if needed. No, if you require active maintenance, security updates, or integration with a modern financial library ecosystem. Consider alternatives if this is for production financial systems.
Install
yearfrac on PyPI
pip
pip install yearfracuv
uv add yearfracpoetry
poetry add yearfracInstalling yearfrac
Before you install
High install friction: the package is abandoned (last release 1285 days ago, last commit 2023-05-09) with no active maintenance. It has no runtime dependencies, so installation itself is straightforward, but you are adopting unmaintained code with no path to bug fixes or security updates.
License in practice
MIT license is permissive and imposes no restrictions on use, modification, or distribution in your own projects.
Quickstart
pip install yearfrac
from yearfrac import yearfrac
frac = yearfrac(start_date, end_date, method='act_isda')
print(frac)
Requires Python 3.6 or later.
Verify before relying
- Whether the daycount implementations conform to current financial industry standards (ISDA, AFB) or have known deviations.
- Whether the package handles edge cases (leap seconds, calendar transitions, invalid dates) as expected for financial use.
- Real-world accuracy and test coverage of Easter date and Julian Day conversions.
- Specific date ranges and scenarios the package has been tested against.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.6) |
| Install friction | high — source build required |
| Runtime dependencies | none |
| Maintenance | abandoned — 1,285 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 153,928/month — #10,866 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: yearfrac-0.4.8.tar.gz
Tags
More Mathematics packages
NetworkX provides data structures and…
permissive · top 1,000 on PyPI
kiwisolverkiwisolver is a Python binding to a fast C++…
permissive · top 1,000 on PyPI
sympySymPy is a Python library for symbolic…
permissive · top 1,000 on PyPI
contourpyContourPy calculates contours of 2D…
permissive · top 1,000 on PyPI
torchPyTorch provides GPU-accelerated tensor…
permissive · top 1,000 on PyPI
onnxruntimeonnxruntime loads and executes Open Neural…
permissive · top 1,000 on PyPI
convertdateConverts dates between the Gregorian calendar…
permissive · top 5,000 on PyPI
jdcalConverts between Julian dates and Gregorian or…
permissive · top 5,000 on PyPI
fiscalyearProvides fiscal year, quarter, month, and day…
permissive · top 15,000 on PyPI
dateutilsProvides date and time arithmetic operations,…
permissive · top 5,000 on PyPI
lunardateConverts between Gregorian (solar) and Chinese…
copyleft · top 5,000 on PyPI
LunarCalendarConverts between lunar and solar calendar…
permissive · top 15,000 on PyPI
datedeltadatedelta extends Python's datetime module with…
permissive · top 15,000 on PyPI
zhdateConverts between Chinese lunar calendar dates…
copyleft · top 15,000 on PyPI
python-dateutilProvides parsing, arithmetic, and recurrence…
permissive · top 100 on PyPI