w3resource

NumPy Financial functions: pmt() function

numpy.pmt() function

The pmt() function is used to compute the payment against loan principal plus interest.

Syntax:

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

Given:

  • a present value, pv (e.g., an amount borrowed)
  • a future value, fv (e.g., 0)
  • an interest rate compounded once per period, of which there are
  • nper total
  • and (optional) specification of whether payment is made at the beginning (when = {'begin', 1}) or the end (when = {'end', 0}) of each period

Version: 1.15.0

Parameter:

Name Description Required /
Optional
rate Rate of interest (per period)
array_like
Required
nper Number of compounding periods
array_like
Required
pv Present value
array_like
Required
fv Future value (default = 0)
array_like
Optional
when When payments are due ('begin' (1) or 'end' (0))
{{'begin', 1}, {'end', 0}}, {string, int}
Required

Return value: the (fixed) periodic payment.

Returns: out : ndarray

Payment against loan plus interest.
If all input is scalar, returns a scalar float. If any input is array_like, returns payment for each input element.
If multiple inputs are array_like, they all must have the same shape.

Notes:

The payment is computed by solving the equation:

fv +
pv*(1 + rate)**nper +
pmt*(1 + rate*when)/rate*((1 + rate)**nper - 1) == 0

or, when rate == 0:

fv + pv + pmt * nper == 0

for pmt.

Note that computing a monthly mortgage payment is only one use for this function. For example, pmt returns the periodic deposit one must make to achieve a specified future balance given an initial deposit, a fixed, periodically compounded interest rate, and the total number of periods.

NumPy.pmt() method Example:

What is the monthly payment needed to pay off a $100,000 loan in 12 years at an annual interest rate of 8.5%?

>>> import numpy as np
>>> np.pmt(0.085/12, 12*12, 100000)

Output:

-1110.0555643145096

In order to pay-off (i.e., have a future-value of 0) the $100,000 obtained today, a monthly payment of $1,110.05 would be required. Note that this example illustrates usage of fv having a default value of 0.

Python - NumPy Code Editor:

Previous: npv() function
Next: ppmt() function



Follow us on Facebook and Twitter for latest update.