Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DOC: Add warning to NPV function #14508

Merged
merged 2 commits into from
Sep 15, 2019
Merged

DOC: Add warning to NPV function #14508

merged 2 commits into from
Sep 15, 2019

Conversation

Kai-Striega
Copy link
Member

@Kai-Striega Kai-Striega commented Sep 14, 2019

closes #10877

This PR:

  • Clarifies that np.npv calculates the net present value (NPV) of a series of cashflows (at the start of each period) , rather than of a series of future cashflows (at the end of each period).

  • Adds an example splitting the cashflows into an initial investment and future cashflows.

  • Refactors the NPV-IRR congruence check as a formal example.

@joelowj do you think these changes would have helped you / would be clearer for someone like you to understand.

@seberg I don't think I have access to the built documentation, would you confirm that it was formatted correctly?

``np.npv`` calculates the present value of a series of cashflows
starting in the present (t=0). Another common definition of NPV
uses the future cashflows i.e. starting at the end of the first
period.

The difference in definition can lead to confusion for users moving
between NumPy and other projects [1] and adds complexity for
maintainers [2]. This commit adds a warning to the ``npv``
function's documentation and adds an example on how to find the npv
of a project using the alternate definition.

[1] https://github.com/numpy/numpy/issue/10877
[2] #3346
The internal rate of return (irr) is defined as the rate of return
required for the net present values of a series of cashflows to be
zero. i.e the lowest rate of return required for a project to break
even.

This is currently checked by refering to the example output from
the ``irr`` and ``npv`` function documentation. This commit adds a
test to confirm the identity holds.
@seberg
Copy link
Member

seberg commented Sep 14, 2019

@joelowj
Copy link

joelowj commented Sep 14, 2019

@Kai-Striega, thanks for your time and effort! Yup, that would make the behaviour pretty clear! 👍

@seberg
Copy link
Member

seberg commented Sep 15, 2019

OK, it reads fine to me as well. I will trust @Kai-Striega and @joelowj that the finance makes sense :). Thanks both of you! Honestly did not know there was a warnings section and not just a tag, but may as well use it since it renders right.

@seberg seberg merged commit 53adf81 into numpy:master Sep 15, 2019
@Kai-Striega Kai-Striega deleted the financial_review branch September 17, 2019 10:06
@Kai-Striega
Copy link
Member Author

@seberg

My understanding is that the warnings cautions the user whereas warns list the warnings (as in the Python object) which could be raised.

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.

NPV function return wrong value
3 participants