MAINT: Avoid ``ZeroDivisionError``s in ``nper_inner_loop``
Open
Nobody has claimed this yet.
Cython
maintenance
- Dominant language
- Python
- Stars
- 409
- Forks
- 98
- Avg merge
- 10h 43m
- Merged PRs (30d)
- 12
Description
Proposed new feature or change:
I've just merged #118, this PR reproduced the behaviour of nper in Cython as closely as possible. However there are several ZeroDivisionErrors that are currently handled poorly (they return NANs).
In each case, we should carefully evaluate each code path and return a financially sensible result.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in numpy_financial/_cfinancial.pyx at lines 21-22 and trace each nper_inner_loop code path that can raise ZeroDivisionError. Determine the financially sensible result for each case, then verify that the affected paths no longer produce NaNs.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- fintech-quant
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100