Repository navigation
ENH: Add cumprinc and cumipmt - #165
franrizz15 wants to merge 2 commits into
Conversation
|
@InessaPawson fyi added the PR, could not change the label to sustain-2026 |
InessaPawson
left a comment
There was a problem hiding this comment.
Thanks for picking this up, @franrizz15 !
Two small requests before this is ready for merge:
- Add
cumprincandcumipmtto the autosummary list indoc/source/api.rstso they show up in the rendered documentation. - Add an entry to
CHANGELOG.mdunder the unreleased section.
|
@InessaPawson thank you for the quick reply! Added them |
|
@lcrmorin since you were interested in helping more with the project. If you have time, do you have thoughts on this (and maybe other recent PRs)? Especially, since it expands API. |
|
@seberg basically this is implementing some widely used Excel functions. It is a good idea and the direction I had in mind. However I am not entirely sure how to proceed. Do we want to keep exactly same name and functioning ? Notably 1) Isn't there a legal issue ? and 2) should we ensure exact match trough testing ? |
Hi @lcrmorin , wanted to understand more about the concern. 1) what would be the legal issue of adding functions with the same name as excel, the functions offered in npf already share acronyms with excel functions. I am not saying there is not an issue with it, but I wonder, if there was, wouldn’t we need to change all the names? thanks |
|
My understanding is that the legal risk should be very small (there was a big court case once around API not being copyrightable); it seems also a good chance there are many others who use this name by now. That said, there are some concerns around copyright (at least if docs are too close). But there is a another point here maybe: Can't we find a nicer name anyway, even |
|
Interesting, didn’t know about the API copyright concerns. Appreciate the background. |
PR summary
This PR is related to #38.
Adds
cumprincandcumipmtto calculate the cumulative principal and interest paid between two periods, matching the Excel/SAS functions of the same names. Both functions include the start and end periods.cumprincis computed as the difference between two loan balances rather than by summingppmtperiod by period. Each principal payment is the amount the balance falls that period, so the sum telescopes and only the endpoints survive:_rblreports the balance entering a period, hence theend + 1.when='begin'the payment lands before the period's interest accrues, so both balances are discounted one period except atstart == 1, where nothing has accrued yet.cumipmtthen follows frompmt = ipmt + ppmtsummed over the range:I was looking for enhancement issues that would allow me to get a good understanding of the library's structure and available functionality. This one got my attention since it is closely related to the existing
ipmtandppmt.I am part of the 2026 Sustain cohort, would like to keep contributing to open source, especially numpy-financial.
First time contributor introduction
Hi! I am new to the community - I will be contributing to numpy and numpy-financial through the open source initiative run by my company.
AI Disclosure
I used claude to navigate the current codebase to identify what pieces of code I could reuse and to make sure the style matched the existing code.