# What is the numpy.npv() Method

Numpy.npv() method is “used to calculate the NPV(Net Present Value) of a cash flow series.”

## Syntax

``numpy.npv(rate, values)``

## Parameters

1. rate: This indicates the rate of the discount.
2. values: The values of the time series of cash flows. The (fixed) period between cash flow “events” must be the same as that for which the rate is given (i.e., if the rate is per year, then precisely one year for each cash flow event is understood to elapse). By definition, investments or “deposits” are negative, and income or “withdrawals” are positive; values must start with the initial investment, so usually negative values[0] are.

## Return Value

The npv() function returns NPV values as per the given value.

## Example: How to Use numpy.npv() method

``````import numpy as np

values = [45, 50, 40, -100]
rate1 = 0.50
rate2 = 0.30
rate3 = 1

#Printing NPV Values
print("NPV value with rate ", rate1, " is: ", np.npv(rate1, values))
print("NPV value with rate ", rate2, " is: ", np.npv(rate2, values))
print("NPV value with rate ", rate3, " is: ", np.npv(rate3, values))``````

Output

``````NPV value with rate 0.5 is: 66.48148148148148
NPV value with rate 0.3 is: 61.61356395084205 NPV value with rate 1 is: 67.5``````

That’s it.

This site uses Akismet to reduce spam. Learn how your comment data is processed.