Skip to content

np.pmt documentation is misleading on calculating monthly rate #34

@kigawas

Description

@kigawas

Documentation

To calculate the monthly rate, you should calculate as (1 + annual_rate) ** (1/12) - 1 rather than simply divide it by 12.

    Examples
    --------
    >>> import numpy_financial as npf

    What is the monthly payment needed to pay off a $200,000 loan in 15
    years at an annual interest rate of 7.5%?

    >>> npf.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.

Should be rephrased to

    Examples
    --------
    >>> import numpy_financial as npf

    What is the monthly payment needed to pay off a $200,000 loan in 15
    years at an annual interest rate of 7.5%?

    >>> npf.pmt(1.075**(1/12) - 1, 12*15, 200000)
    -1826.1657857130267

    In order to pay-off (i.e., have a future-value of 0) the $200,000 obtained
    today, a monthly payment of $1,826.17 would be required.  Note that this
    example illustrates usage of `fv` having a default value of 0.

https://github.com/numpy/numpy-financial/blob/master/numpy_financial/_financial.py#L220-L232

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions