NumPy参考 >例行程序 >Financial functions > numpy.pmt
numpy.
pmt
(rate, nper, pv, fv=0, when='end')[source]¶Compute the payment against loan principal plus interest.
Deprecated since version 1.18: pmt
is deprecated; for details, see NEP 32 [1].
Use the corresponding function in the numpy-financial library,
https://pypi.org/project/numpy-financial.
the (fixed) periodic payment.
Rate of interest (per period)
Number of compounding periods
Present value
Future value (default = 0)
When payments are due (‘begin’ (1) or ‘end’ (0))
Payment against loan plus interest. If all input is scalar, returns a scalar float. If any input is array_like, returns payment for each input element. If multiple inputs are array_like, they all must have the same shape.
Notes
The payment is computed by solving the equation:
fv +
pv*(1 + rate)**nper +
pmt*(1 + rate*when)/rate*((1 + rate)**nper - 1) == 0
or, when rate == 0
:
fv + pv + pmt * nper == 0
for pmt
.
Note that computing a monthly mortgage payment is only one use for this function. For example, pmt returns the periodic deposit one must make to achieve a specified future balance given an initial deposit, a fixed, periodically compounded interest rate, and the total number of periods.
References
NumPy Enhancement Proposal (NEP) 32, https://numpy.org/neps/nep-0032-remove-financial-functions.html
Wheeler, D. A., E. Rathke, and R. Weir (Eds.) (2009, May). Open Document Format for Office Applications (OpenDocument)v1.2, Part 2: Recalculated Formula (OpenFormula) Format - Annotated Version, Pre-Draft 12. Organization for the Advancement of Structured Information Standards (OASIS). Billerica, MA, USA. [ODT Document]. Available: http://www.oasis-open.org/committees/documents.php ?wg_abbrev=office-formulaOpenDocument-formula-20090508.odt
Examples
What is the monthly payment needed to pay off a $200,000 loan in 15 years at an annual interest rate of 7.5%?
>>> np.pmt(0.075/12, 12*15, 200000)
-1854.0247200054619
In order to pay-off (i.e., have a future-value of 0) the $200,000 obtained
today, a monthly payment of $1,854.02 would be required. Note that this
example illustrates usage of fv
having a default value of 0.