docs: add Triangle arithmetic examples (#704) - #1213
Conversation
Co-authored-by: Cursor <cursoragent@cursor.com>
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 #1213 +/- ##
==========================================
- Coverage 91.25% 91.25% -0.01%
==========================================
Files 91 91
Lines 5400 5399 -1
Branches 691 691
==========================================
- Hits 4928 4927 -1
Misses 338 338
Partials 134 134
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:
|
| .. testsetup:: | ||
|
|
||
| import chainladder as cl | ||
| tri = cl.Triangle( |
There was a problem hiding this comment.
should tri be in testcode instead?
There was a problem hiding this comment.
Moved. testsetup is only import chainladder as cl; the Triangle is built in testcode.
|
macro comment. i don't see @kennethshsu @genedan @priyam0k should we follow pandas? |
… testcode. testsetup stays as the chainladder import only, matching the other API doctest examples. Co-authored-by: Cursor <cursoragent@cursor.com>
|
On following pandas Leaving whether to add pandas-style |
yeah, that's what I mean, taking inspiration from your other PR on |
|
I think these examples are useful. I think dunders and arithmetic operators fall under "advanced programming for actuaries" territory, so it'd be helpful for them to see how the operators are related to the dunders, and how we program them into the package. |
|
Agree with Gene. Documenting dunders makes sense here since operators are Triangle's current arithmetic API. The main benefit of pandas .add() would be supporting fill_value for mismatched triangles, but we can track .add() in a separate feature issue if needed. |
|
sounds good. all set on docstrings. ruff fix pls? also outstanding question on api template change |
…ate. The ruff workflow lints touched files with per-file ignores cleared. The template unions documented Triangle attrs and arithmetic dunders so sibling casact#704 PRs do not clobber each other on merge. Co-authored-by: Cursor <cursoragent@cursor.com>
… autosummary template. The ruff workflow lints touched files with per-file ignores cleared. The template now unions the documented Triangle attrs and arithmetic dunders so casact#1208, casact#1212, and casact#1213 do not clobber each other on merge. Co-authored-by: Cursor <cursoragent@cursor.com>
The last merge of casact#1208/casact#1211/casact#1212/casact#1213 would otherwise wipe documented indexers, shape attrs, or arithmetic dunders. Co-authored-by: Cursor <cursoragent@cursor.com>
|
good with changes. please resolve conflict |
Co-authored-by: Cursor <cursoragent@cursor.com>
|
Merged |
CI pandas pads the development-age header with extra spaces; the cell values already matched. Co-authored-by: Cursor <cursoragent@cursor.com>
|
Doctest miss was header padding on |
* docs: add Triangle shape/empty/compute doctest examples (#704) Co-authored-by: Cursor <cursoragent@cursor.com> * Tighten TriangleBase examples from review on nan_triangle, get_array_module, and compute. Print the nan mask as-is, show numpy/sparse module identity, and document compute with a dask code sample instead of a numpy no-op doctest. Co-authored-by: Cursor <cursoragent@cursor.com> * Fix E721 in TriangleBase, show a fake compute() output, and align the autosummary template. The ruff workflow lints touched files with per-file ignores cleared. The template now unions the documented Triangle attrs and arithmetic dunders so #1208, #1212, and #1213 do not clobber each other on merge. Co-authored-by: Cursor <cursoragent@cursor.com> --------- Co-authored-by: Cursor <cursoragent@cursor.com>
Summary of Changes
ExamplesforTriangle.__add__,.__sub__,.__mul__, and.__truediv__inchainladder/core/dunders.py.__add__/__sub__/__mul__/__truediv__asspecial-memberson the inherited-class autosummary template so the operators appear on the Triangle API page.Related GitHub Issue(s)
Additional Context for Reviewers
Bite-sized core-module follow-up for #704. Companions: #1208 (slice), #1209 (io), #1210 (display).
Checklist
Made with Cursor