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.26% 91.26%
=======================================
Files 91 91
Lines 5401 5401
Branches 691 691
=======================================
Hits 4929 4929
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. |
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