Calculating the duration to complete a loan

Overview:

  • Given the values for the interest rate, payment amount(due, installment, periodic payment amount) and the net present value towards a loan, the number of payments required to complete the loan payment is calculated by the nper() function of numpy.

Example:

# Example Python program that calculates

# the number of payments required to complete

# the payment for a loan

 

import numpy as np

 

compoundingFrequency    = 1; # Once in 12 months

interestRatepercent     = 7;  

outstandingLoanAmount   = 75000;

 

periodicPayment         = 1200;

 

 

numberOfPayments    = np.nper((interestRatepercent/100)/12, -periodicPayment,

                              outstandingLoanAmount);

paymentMonths       = np.round(numberOfPayments, 3);

                  

print("Number of months required to complete the loan payment:");                             

print(paymentMonths);

 

 

Output:

Number of months required to complete the loan payment:

77.965

 


Copyright 2024 © pythontic.com