Book Image

NumPy: Beginner's Guide

By : Ivan Idris
Book Image

NumPy: Beginner's Guide

By: Ivan Idris

Overview of this book

Table of Contents (21 chapters)
NumPy Beginner's Guide Third Edition
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
NumPy Functions' References
Index

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.