BUG: support DataFrame columns containing period arrays - #156
sb123sb123 wants to merge 4 commits into
Conversation
|
|
||
| def _broadcast_payment_inputs( | ||
| rate: Any, per: Any, nper: Any, pv: Any, fv: Any, when: Any | ||
| ) -> tuple[Any, Any, Any, Any, Any, Any]: |
There was a problem hiding this comment.
Is there any point in adding the typing info when it is all Any?
There was a problem hiding this comment.
You were right: the six NDArray[Any] entries did not narrow the helper’s dynamic broadcast result. I removed the return annotation and kept the _ArrayLike input annotations. Ruff, Python 3.13.15 py_compile, and the focused nested-period regression test pass (1 passed). The source checkout lacks the compiled _cfinancial extension, so the focused test used a temporary import stub; this test path does not call that extension.
|
The revised head is 59c55de. The focused regression, Ruff, and Python 3.13 syntax checks pass locally. GitHub has created Test package and Type-check runs for this commit, but both are currently |
Summary
ipmt fails when its per input is a pandas Series of same-shaped period arrays and the other inputs are row-wise Series. Stack the period arrays into a row-by-period matrix, expand matching row parameters into columns, and broadcast them together. Apply the same normalization in ppmt and add regression coverage for both functions without adding a pandas test dependency.
Fixes #105.
Validation
AI assistance was used to prepare this change and its tests.