# Use of numpy.irr( ) in Python

In this article, we will see how to use **numpy.irr() method in Python** with some basic and easy examples. In many situations, you may come across some problems in which this function may be useful.

## numpy.irr() method in Python

IRR stands for the Internal Rate of Return. The irr( ) method provided by NumPy helps in making investment decisions. This is a financial function that helps the user to compute the IRR Value(average value) periodically compounded rate of return. Thus we can decide whether to accept or reject a project/investment. It is basically the discount rate at which NPV becomes zero. The irr( ) takes only one argument, i.e, value.

Syntax: np.irr(values)

Net deposits are treated as negative values and net withdrawals are treated as positive values. Thus, the first element of values will be always negative representing initial investment.

Suppose that an investor invests 500 rupees, then this value will be fed as a negative value. Any amount which is withdrawn from the project will be fed as a positive value.

An example showing the working of irr() method is as shown:

#importing NumPy as np import numpy as np ''' Investment = 500 Withdrawls at regular interval : 30, 15, 20, 10 ''' #use of irr() R = np.irr([-500, 30, 15, 20, 10]) print("Internal Rate of Return : ", R)

```
Output:
Internal Rate of Return : -0.5210176246017068
```

#importing NumPy as np import numpy as np ''' Investment = 800, 200, 200 Withdrawls at regular interval : 500, 150, 300, 100, 500, 452, 542 ''' #use of irr() R = np.irr([-800,500,150,300,100,-200,500,452,542,-200]) print("Internal Rate of Return : ", R)

Output: Internal Rate of Return : 0.30810835901251754

Also read:

## Leave a Reply