Uh oh!
There was an error while loading. Please reload this page.
Pandas annotations - #1065
Conversation
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): 77.8% fully typed (7 / 9); 3 no longer exported
Patch symbol details
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@## main #1065 +/- ##
==========================================
+ Coverage 89.47% 90.51% +1.03%
==========================================
Files 91 91 Lines 5284 5863 +579 Branches 681 852 +171 ==========================================
+ Hits 4728 5307 +579 + Misses 388 386 -2 - Partials 168 170 +2
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:
|
| def groupby(self, by, axis=0, *args, **kwargs): | ||
| """Group Triangle by index values. If the triangle is convertable to a | ||
| def groupby(self, by, axis: Literal[0, 1, 2, 3] = 0) -> TriangleGroupBy: |
henrydingliu
commented
Jun 28, 2026
given this quick change in approach, I'm going to have to insist that we put down a first version of architecture.md before more typing work |
| """Append rows of other to the end of caller, returning a new object. | ||
| def append(self, other: Triangle) -> Triangle: | ||
| """ | ||
| Append rows another Triangle to self, returning an updated Triangle. |
Uh oh!
There was an error while loading. Please reload this page.
Summary of Changes
Main change is inheriting from
TriangleProtocolinstead of using the patternself: TriangleProtocol. I find this to be much cleaner, less repetitive. My IDE can also find declarations more easily.Related GitHub Issue(s)
#486
Additional Context for Reviewers
Removed some unused parameters, Renamed some variables due to shadowing. These don't impact the public API.
uv run pytest) and documentation changes (uv run jb build docs --builder=custom --custom-builder=doctest)Note
Low Risk
Changes are typing, imports, and internal delegation; the only behavioral tweak is Triangle.round using round, which should match prior Triangle rounding semantics.
Overview
Typing and structure:
TrianglePandasnow subclasses a runtimeobjectbase and only inheritsTriangleProtocolunderTYPE_CHECKING, replacing repeatedself: TriangleProtocolannotations.TriangleProtocolgains setters for index/columns/origin/development, treatsvaluation_dateas a plain attribute, tightensfillna’s value type, and documents__round__.chainladder/core/pandas.py: Public pandas-like methods pick up explicit return/parameter types; mutating helpers (rename,astype, inplacefillna/fillzero) usecasttoTrianglewhere needed.appendimportsconcatat module level;to_frame’s sparse path uses a localvalues: COOinstead of mutatingobj.values.roundnow delegates toself.__round__(decimals)instead of the builtinround(self, …).groupbydrops*args/**kwargsand types the return asTriangleGroupBy. Docstrings and small cleanups (dropmessage,Treturn type,xsdocs, loop variable renames).Reviewed by Cursor Bugbot for commit b77bc07. Bugbot is set up for automated code reviews on this repo. Configure here.