w3resource

NumPy Financial functions: npv() function

numpy.npv() function

The npv() function is used to get the NPV (Net Present Value) of a cash flow series.

Syntax:

numpy.npv(rate, values)

Version: 1.15.0

Parameter:

Name Description Required /
Optional
rate The discount rate.
scalar
Required
values The values of the time series of cash flows. The (fixed) time interval between cash flow "events" must be the same as that for which rate is given (i.e., if rate is per year, then precisely a year is understood to elapse between each cash flow event). By convention, investments or "deposits" are negative, income or "withdrawals" are positive; values must begin with the initial investment, thus values[0] will typically be negative.
array_like, shape(M, )
Required

Returns: out : float

The NPV of the input cash flow series values at the discount rate.

Notes:

Returns the result of: [G]

\sum_{t=0}^{M-1}{\frac{values_t}{(1+rate)^{t}}}

NumPy.npv() method Example:

>>> import numpy as np
>>> np.npv(0.281,[-200, 39, 59, 55, 20])

Output:

-100.00847859163845

(Compare with the Example given for numpy.lib.financial.irr)

Python - NumPy Code Editor:

Previous: pv() function
Next: pmt() function



Become a Patron!

Follow us on Facebook and Twitter for latest update.

It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.

https://www.w3resource.com/numpy/financial-functions/npv.php