我正在参加 Coursera 的类(class),对一个简单的 NPV 函数感到困惑。
问题:
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 美元
excel 答案被认为是正确的,并且在 numpy_financial NPV 函数中似乎没有任何可行的参数。有谁知道如何在 Python 中获取 excel 的值?
最佳答案
Excel假设第一个值在 t=1(没有初始财富),而 numpy-financial假定第一个值在 t=0。因此,在 numpy 中,你从 4000 的初始财富开始,你的结果基本上是 excel 结果 * 1.06。
如果要用numpy计算excel结果,将初始财富设置为零:
npf.npv(0.06, [0] + [4000 for i in range(8)])
关于python - 净现值——Numpy 与 Excel,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65454574/