Time for action – calculating the periodic payments

Suppose you have a loan of 10 million with an interest rate of 1 percent. You have 30 years to pay the loan back. How much do you have to pay each month? Let's find out.

Call the pmt() function with the aforementioned values:

print("Payment", np.pmt(0.01/12, 12 * 30, 10000000))

The monthly payment:

Payment -32163.9520447

What just happened?

We calculated the monthly payment for a loan of 10 million at an annual rate of 1 percent. Given that we have 30 years to repay the loan the pmt() function tells us that we need to pay 32163.95 per month.

Get NumPy : Beginner's Guide - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.