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 – figuring out the rate


Let's take the values from the Time for action – determining the number of periodic payments section and reverse compute the interest rate from the other parameters.

Fill in the numbers from the previous Time for action section:

print("Interest rate", 12 * np.rate(167, -100, 9000, 0))

The interest rate is approximately 10 percent as expected:

Interest rate 0.0999756420664

What just happened?

We used the NumPy rate() function and the values from the Time for action – determining the number of periodic payments section to compute the interest rate of the loan. Ignoring the rounding errors, we got the initial 10 percent we started with.