Skip to content

docs: add Triangle loc/iloc/at/iat examples (#704) - #1208

Open
EKtheSage wants to merge 4 commits into
casact:mainfrom
EKtheSage:docs/704-slice-examples
Open

docs: add Triangle loc/iloc/at/iat examples (#704)#1208
EKtheSage wants to merge 4 commits into
casact:mainfrom
EKtheSage:docs/704-slice-examples

Conversation

@EKtheSage

Copy link
Copy Markdown
Contributor

Summary of Changes

  • Add doctest Examples for Triangle.loc, .iloc, .at, .iat, column [] selection, and column assignment in chainladder/core/slice.py.
  • Document loc / iloc / at / iat as properties so the examples appear on the Triangle API page (instead of being excluded as attributes).
  • Keep indexers pointing at the current Triangle after copy() / slicing by constructing them on access.

Related GitHub Issue(s)

Additional Context for Reviewers

This is the first of the remaining core-module PRs for #704 (slice.py is the highest-priority leftover). Follow-ups: base.py, common.py, display.py, dunders.py, io.py, and remaining pandas.py methods.

loc/iloc/at/iat are now properties that always wrap self. _set_slicers only refreshes virtual_columns. Slicing tests: 72 passed; triangle+slicing: 345 passed.

Checklist

  • I passed tests locally for both code (uv run pytest) and documentation changes (uv run --directory docs jb build . --builder=custom --custom-builder=doctest)

Made with Cursor

Co-authored-by: Cursor <cursoragent@cursor.com>
@github-actions

github-actions Bot commented Aug 13, 2026

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): 15.1% of exported symbols fully typed (201 / 1333)

Known Ambiguous Unknown Total
Project (head) 201 111 1021 1333

Other symbols referenced but not exported by chainladder: 13

Known Ambiguous Unknown Total
Other (head) 3 1 9 13

Symbols without documentation:

  • Functions without docstring: 321
  • 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 Aug 13, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.55172% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 91.28%. Comparing base (272cbe1) to head (d3c2059).

Files with missing lines Patch % Lines
chainladder/core/triangle.py 92.30% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1208      +/-   ##
==========================================
+ Coverage   91.25%   91.28%   +0.02%     
==========================================
  Files          91       91              
  Lines        5400     5413      +13     
  Branches      691      692       +1     
==========================================
+ Hits         4928     4941      +13     
  Misses        338      338              
  Partials      134      134              
Flag Coverage Δ
unittests 91.28% <96.55%> (+0.02%) ⬆️

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

Copy link
Copy Markdown
Member

@genedan there's some restructuring here on slice. could you please review?

@genedan genedan self-assigned this Aug 13, 2026
EKtheSage added a commit to EKtheSage/chainladder-python that referenced this pull request Aug 14, 2026
… 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>
EKtheSage and others added 3 commits August 13, 2026 20:51
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>
Named doctest groups keep loc/iloc/at/iat from picking up another Triangle page `tri`. triangle.py gets the same E721/E731/F401/F841/E712 cleanup CI requires once the file is touched.

Co-authored-by: Cursor <cursoragent@cursor.com>
@EKtheSage

Copy link
Copy Markdown
Contributor Author

Merged main.

Ruff: this PR touches triangle.py (dropped the duplicate loc/iloc attribute lines), so CI clears ignores on that file too. Same E721/E731/F401/F841/E712/E2 cleanup as #1212.

Doctest: loc/iloc/at/iat were in the default group and reused tri from testsetup, so other Triangle-page examples overwrote it (KeyError: paid, empty slices). Each accessor now has its own named group; tri is built in testcode.

henrydingliu pushed a commit that referenced this pull request Aug 14, 2026
* 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>
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.

3 participants