Python study notes: PMT and PV functions

One, PMT function

  • The PMT function is an annuity function, based on a fixed interest rate and equal installment payment method, returns the loan payment amount per installment.

1. Grammar format

  • PMT(rate, nper, pv, [fv], [type])

2. Syntax parameters

  • rate: loan interest rate (period interest rate)
  • nper: the total number of payment periods for the loan (total number of years or lease repayment period)
  • pv: present value (lease principal), or the cumulative sum of the current value of a series of future payments, also called principal.
  • fv: Future value (residual value), or the cash balance expected to be obtained after the last payment. If fv is omitted, its value is assumed to be zero, that is, the future value of a loan is zero.
  • type: 0 or 1, used to specify whether the payment time of each period is at the beginning or the end of the period
    -1 represents the beginning of the period (payment in advance : paid on the first day of each period)-do
    not enter or enter 0 for the end of the period (after payment: for each period Pay on the last day)

3. Parameter description

  • Payments returned by PMT include principal and interest, but do not include taxes, retained payments or certain loan-related expenses.

Two, PV function

  • Given the interest rate, the number of repayment periods, and the repayment amount per period, the PV function can return the present value of a loan.

1. Grammar format

PV(rate, nper, pmt, [fv], [type])

2. Syntax parameters

  • rate is the interest rate of each period. For example, if you borrow a loan at an annual interest rate of 12% to buy a car, and repay the loan monthly, the monthly interest rate is 12%/12 (that is, 1%). You can enter 12%/12, 1%, or 0.01 in the formula as the value of rate.
  • nper is the total investment (or loan) period, that is, the total number of payment periods for the investment (or loan). For example, for a 5-year auto loan that is repaid on a monthly basis, there are 5*12 (that is, 60) repayment periods. You can enter 60 as the value of nper in the formula.
  • pmt is the amount payable in each period, and its value remains unchanged throughout the annuity period. Usually pmt includes principal and interest, but not other fees and taxes. For example, a four-year car loan with a $10,000 annual interest rate of 12% has a monthly payment of $263.33. You can enter -263.33 as the value of pmt in the formula. If pmt is omitted, the fv parameter must be included.
  • fv is the future value, or the cash balance expected after the last payment. If fv is omitted, its value is assumed to be zero (the future value of a loan is zero). For example, if you need to pay $60,000 after 12 years, then $60,000 is the future value. The monthly deposit amount can be determined based on conservatively estimated interest rates. If fv is omitted, the pmt parameter must be included.
  • The type number 0 or 1, used to specify whether the payment time of each period is at the beginning or the end of the period.

Three, case demonstration

1. A loan of 300,000 yuan, with an annual interest rate of 3.57%, will be paid off in 15 years, the last day of each instalment will be paid in equal installments, and how much is the monthly repayment.

  • Import the scipy module and call the pmt function to calculate
    Insert picture description here
  • Monthly repayment of 2154.98 yuan
  • Using the pv function to reverse inference, the present value after 15 years ≈ \approx 300,000
    Insert picture description here

2. A loan of 300,000, with an annual interest rate of 3.57%, 15 years of repayment, after the last repayment, I hope to get 50,000, and the first day of each instalment shall be paid in equal installments. Ask how much yuan to repay each month.

  • Import the scipy module and call the pmt function to calculate
    Insert picture description here
  • Monthly repayment of 2,538.37 yuan
  • Use the pv function to inversely calculate the current price after 15 years ≈ \approx 300,000
    Insert picture description here

Guess you like

Origin blog.csdn.net/howard2005/article/details/109171126