Skip to content

[DOCS] Build the data tutorial's triangle with age= instead of a valuation year - #1645

Merged
henrydingliu merged 1 commit into
casact:mainfrom
scks1:#1643-data-tutorial-age
Nov 17, 2026
Merged

henrydingliu merged 1 commit into
casact:mainfrom
scks1:#1643-data-tutorial-age

Conversation

@scks1

@scks1 scks1 commented Nov 17, 2026

Copy link
Copy Markdown
Contributor

Summary of Changes

The "Converting Triangle Data into Long Format" section of the data tutorial built a valuation year with (df["origin"].dt.year + df["age"] / 12 - 1).astype(int) before calling cl.Triangle. Since #1401 the constructor takes development ages through age=, so the section now passes the age column directly and drops the valuation cell. The new text also says that data with a valuation date for each cell would use valuation= instead. An earlier cell now says "long format" where it said "wide long format".

The formula is right for RAA, whose ages are whole years from annual origins, but not in general. On the quarterly sample, with annual origins and quarterly ages, it gives the wrong valuation year in 210 of 276 cells, while age= rebuilds the sample exactly.

Related GitHub Issue(s)

Closes #1643

The change follows #1401, which added the age= argument, and #1458, which renamed development= to valuation= in this cell.

AI/LLM Usage

This change was made with Árbol, an AI assistant running on Muse, working under my direction. It wrote the change, ran the checks below and drafted this description.

Additional Context for Reviewers

The notebook runs end to end with nbclient and no errors. The triangle cell's output is identical, in both its text and its HTML, to the output committed on main, and the triangle it builds equals cl.load_sample("raa") cell for cell, with the same origins, ages and valuation date.

The edit removes one code cell and its output and changes three source cells. The other cells keep their committed outputs and execution counts, so the counts now skip 5.

Submitter's Checklist

  • I have reviewed and am adhering to the standards outlined in the project Governing Doc.
  • The PR subject title summarizes the changes, with one proper prefix ([FIX], [FEAT], [DOCS], [TST], [CHORE], or [BRK]).
  • I am a human (not a bot), and this PR form is written by a human.

Reviewer's Checklist

  • The implementation addresses the associated issue(s).
  • The implementation is appropriate, maintainable, and follows ARCHITECTURE.md.
  • PR subject title has the proper prefix and the subject is appropriate.
  • Relevant issue(s) are linked.
  • AI/LLM usage is disclosed and appropriate.
  • Documentation and tests are appropriate.
  • CI tests passed, or any failures are acceptable.
  • Leave a comment with the final recommendation (e.g. approve as is, request a secondary review, or flag an area for more review).

The tutorial built a valuation year with
(origin.dt.year + age / 12 - 1).astype(int) before calling the Triangle
constructor. That formula is right only when ages are whole years from
annual origins, and since casact#1401 the constructor takes development ages
directly. The section now passes age="age" and drops the valuation step.
It also fixes "wide long format" to "long format".

Fixes casact#1643

Developed with an AI assistant (Árbol, running Muse).
@github-actions

Copy link
Copy Markdown

Pyright Type Completeness

View the full pyright --verifytypes output for this commit

Project (full chainladder package, at this PR's head): 18.1% of exported symbols fully typed (303 / 1676)

Known Ambiguous Unknown Total
Project (head) 303 96 1277 1676

Other symbols referenced but not exported by chainladder: 24

Known Ambiguous Unknown Total
Other (head) 11 1 12 24

Symbols without documentation:

  • Functions without docstring: 330
  • Functions without default param: 0
  • Classes without docstring: 10

Patch (exported symbols added or changed by this PR): no exported symbol type-completeness changes detected.

@codecov

codecov Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.00%. Comparing base (8d8f90c) to head (6ed2689).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1645   +/-   ##
=======================================
  Coverage   95.00%   95.00%           
=======================================
  Files         100      100           
  Lines        6460     6460           
  Branches      819      819           
=======================================
  Hits         6137     6137           
  Misses        204      204           
  Partials      119      119           
Flag Coverage Δ
unittests 95.00% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@henrydingliu
henrydingliu merged commit a59efc9 into casact:main Nov 17, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[DOC] Build the data tutorial's triangle with age= instead of a valuation formula

2 participants