skillfed

yearfrac

Daycount methods to compute date differences in year units

yearfrac v0.4.8 153.9K downloads/30d#10,866 on PyPI5
Permissive license MIT Abandoned released

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 yearfrac

uv

uv add yearfrac

poetry

poetry add yearfrac

Installing 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

daycount methods year fractiondate difference in yearsactual actual daycount30/360 day count conventionfinancial date calculationsyear fraction calculationaccrued interest date basis
financial-mathdate-calculationsunmaintained

More Mathematics packages