Repository navigation
[DOCS] Build the data tutorial's triangle with age= instead of a valuation year - #1645
Merged
Merged
Conversation
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).
scks1
requested review from
genedan,
henrydingliu and
kennethshsu
as code owners
November 17, 2026 13:24
Pyright Type CompletenessView the full Project (full
Other symbols referenced but not exported by
Symbols without documentation:
Patch (exported symbols added or changed by this PR): no exported symbol type-completeness changes detected. |
Codecov Report✅ All modified and coverable lines are covered by tests. 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
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
henrydingliu
approved these changes
Nov 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 callingcl.Triangle. Since #1401 the constructor takes development ages throughage=, so the section now passes theagecolumn directly and drops the valuation cell. The new text also says that data with a valuation date for each cell would usevaluation=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
quarterlysample, with annual origins and quarterly ages, it gives the wrong valuation year in 210 of 276 cells, whileage=rebuilds the sample exactly.Related GitHub Issue(s)
Closes #1643
The change follows #1401, which added the
age=argument, and #1458, which renameddevelopment=tovaluation=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
[FIX],[FEAT],[DOCS],[TST],[CHORE], or[BRK]).Reviewer's Checklist