admin管理员组文章数量:1558064
一、前言
在财务与nump_financial的路上越走越远了,自从上次学习了终值公式,一发不可收拾,继续学习净现值公式。
现值(present value)是指资产在当前时刻的价值。净现值(net present value)定义为按折现率计算的净现金流之和。
今天学习用numpy_financial的财务净现值公式来计算净现值。
二、程序展示
1、例子描述
现金流量为:-150, 42,48,88,20,38,
利率为3%
计算净现值。
2、净现值计算公式
这个地方要注意,npf.npv的计算公式中,有一段描述:
npv considers a series of cashflows starting in the present (t = 0).
NPV can also be defined with a series of future cashflows, paid at the
end, rather than the start, of each period. If future cashflows are used,
the first cashflow values[0]
must be zeroed and added to the net
present value of the future cashflows. This is demonstrated in the
examples.
主要意思就是必须在现金流的数组中,在最前面增加一个0。也就是下面的cash_flows[0]必须为0,要不然计算结果不正确。
import numpy_financial as npf
cash_flows = [0,-150, 42,48,88,20,38]
netPv = npf.npv(0.03,cash_flows)
print("净现值为:",netPv)
计算结果为:
净现值为: 65.14819752964704
版权声明:本文标题:基于Python、numpy_financial计算资金净现值公式,根据现金流和利率计算净现值 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://m.elefans.com/dongtai/1727383743a1112181.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论