How to Use the numpy.fv() Method

In accordance with NEP 32, the function numpy.fv() was removed from NumPy version 1.20. A replacement for this function is available in the numpy_financial library: https://pypi.org/project/numpy-financial

The numpy.fv() method is “used to calculate the future value”. Future cash flows are measured at the discount rate, and the higher the discount rate, the lower the potential cash flow’s present value.

Syntax

numpy.fv(rate, nper, pmt, fv, when='end')

Parameters

This function takes five arguments:

  1. rate: This decimal value indicates the interest rate per period. This can be a scalar or an array.
  2. nper: This indicates a total compounding period. This can be a scalar or an array.
  3. pmt: This parameter indicates the fixed payment. This can be a scalar or an array.
  4. fv: This parameter indicates the future value. This can be a scalar or an array. The default value is 0.0
  5. when: At the beginning (when = {‘begin’, 1}) or the end (when = {‘end’, 0}) of each period.

Return value

The NumPy fv() function returns a float type value, which indicates the Present Value after the nper period.

Example 1: How to Use np.fv() Method

import numpy as np

rate = 0.10
nper = 10 * 12
pmt = -200
fv = 1100

print("Future Value after a period of ", nper, " is :")
print(np.fv(rate, nper, pmt, fv, when='end'))

Output

Future Value after a period of 120 is:
83436161.93604787

Example 2: Calculating the future values

import numpy as np

rate = np.array((.12, .30, .45))
nper = np.array((100, 120, 50))
pmt = (100, -300, -100)
fv = (-100, 50, 150)

print("Present Value after a period of ", nper, " is :")
print(np.fv(rate, nper, pmt, fv, when='end'))

Output

Present Value after a period of [100 120 50] is :
[-6.12488282e+07 4.47636903e+16 8.45416944e+09]

That’s it!

Leave a Comment

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