Reputation: 164
I am taking a course in Coursera and am boggled by a simple NPV function.
Question:
What is the present value of $4,000 per year annuity for 8 years at an interest rate of 6%?
Excel:
=NPV(6%, 4000, 4000, 4000, 4000, 4000, 4000, 4000, 4000)
=$24,839
Numpy_Financial:
npf.npv(0.06, [4000 for i in range(8)])
=$26,329
The excel answer is accepted as correct, and there do not seem to be any viable parameters in numpy_financial NPV function. Does anyone know how to get excel's value in Python?
Upvotes: 2
Views: 1620
Reputation: 171
Excel assumes that the first value is at t=1 (no initial wealth), while numpy-financial assumes the first value to be at t=0. Therefore, In numpy you start with an initial wealth of 4000 and your result is basically the excel result * 1.06.
If you want to calculate the excel result using numpy, set the initial wealth to zero:
npf.npv(0.06, [0] + [4000 for i in range(8)])
Upvotes: 7