[Numpy-discussion] Behavior or finance.npv function

Guillaume VIRY guillaume.viry at gmail.com
Wed May 22 21:12:09 EDT 2013

Good morning all

I have been using the financial functions for a while now, and the npv
function has always bothered me. Indeed neither the documentation nor the
implementation seem to be correct, and actually are not congruent with each
other either.

As stated in the bug report https://github.com/numpy/numpy/issues/649 :

the documentation states that the summation is from 0 to M (should be M-1,
if the input data is of size M by the way) which is the correct definition,
but the implementation computes a summation from 1 to M, which is known to
be wrong, and a mimic of Excel's NPV behavior.

So basically, we would have the following :

RealNPV(data) = data[0] + CurrentNPV(data[1:])

Both behaviors are fine to me, as long as the documentation is clear about
it. Ideally the implementation should be corrected, but in any case there
should be a documentation fix at least.

I'd be glad to have your opinion about it.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20130523/ee085fc9/attachment.html>

More information about the NumPy-Discussion mailing list