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
- New Content published on w3resource:
- HTML-CSS Practical: Exercises, Practice, Solution
- Java Regular Expression: Exercises, Practice, Solution
- Scala Programming Exercises, Practice, Solution
- Python Itertools exercises
- Python Numpy exercises
- Python GeoPy Package exercises
- Python Pandas exercises
- Python nltk exercises
- Python BeautifulSoup exercises
- Form Template
- Composer - PHP Package Manager
- PHPUnit - PHP Testing
- Laravel - PHP Framework
- Angular - JavaScript Framework
- Vue - JavaScript Framework
- Jest - JavaScript Testing Framework