当前位置: 首页>>代码示例>>Python>>正文


Python numpy.ppmt方法代码示例

本文整理汇总了Python中numpy.ppmt方法的典型用法代码示例。如果您正苦于以下问题:Python numpy.ppmt方法的具体用法?Python numpy.ppmt怎么用?Python numpy.ppmt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在numpy的用法示例。


在下文中一共展示了numpy.ppmt方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_broadcast

# 需要导入模块: import numpy [as 别名]
# 或者: from numpy import ppmt [as 别名]
def test_broadcast(self):
        assert_almost_equal(np.nper(0.075, -2000, 0, 100000., [0, 1]),
                            [21.5449442, 20.76156441], 4)

        assert_almost_equal(np.ipmt(0.1 / 12, list(range(5)), 24, 2000),
                            [-17.29165168, -16.66666667, -16.03647345,
                             -15.40102862, -14.76028842], 4)

        assert_almost_equal(np.ppmt(0.1 / 12, list(range(5)), 24, 2000),
                            [-74.998201, -75.62318601, -76.25337923,
                             -76.88882405, -77.52956425], 4)

        assert_almost_equal(np.ppmt(0.1 / 12, list(range(5)), 24, 2000, 0,
                                    [0, 0, 1, 'end', 'begin']),
                            [-74.998201, -75.62318601, -75.62318601,
                             -76.88882405, -76.88882405], 4) 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:18,代码来源:test_financial.py

示例2: test_broadcast

# 需要导入模块: import numpy [as 别名]
# 或者: from numpy import ppmt [as 别名]
def test_broadcast(self):
        assert_almost_equal(np.nper(0.075, -2000, 0, 100000., [0, 1]),
                            [21.5449442, 20.76156441], 4)

        assert_almost_equal(np.ipmt(0.1/12, list(range(5)), 24, 2000),
                            [-17.29165168, -16.66666667, -16.03647345,
                                -15.40102862, -14.76028842], 4)

        assert_almost_equal(np.ppmt(0.1/12, list(range(5)), 24, 2000),
                            [-74.998201, -75.62318601, -76.25337923,
                                -76.88882405, -77.52956425], 4)

        assert_almost_equal(np.ppmt(0.1/12, list(range(5)), 24, 2000, 0,
                                    [0, 0, 1, 'end', 'begin']),
                            [-74.998201, -75.62318601, -75.62318601,
                                -76.88882405, -76.88882405], 4) 
开发者ID:ryfeus,项目名称:lambda-packs,代码行数:18,代码来源:test_financial.py

示例3: test_broadcast

# 需要导入模块: import numpy [as 别名]
# 或者: from numpy import ppmt [as 别名]
def test_broadcast(self):
        assert_almost_equal(np.nper(0.075, -2000, 0, 100000., [0, 1]),
                            [ 21.5449442,  20.76156441], 4)

        assert_almost_equal(np.ipmt(0.1/12, list(range(5)), 24, 2000),
                            [-17.29165168, -16.66666667, -16.03647345,
                                -15.40102862, -14.76028842], 4)

        assert_almost_equal(np.ppmt(0.1/12, list(range(5)), 24, 2000),
                            [-74.998201, -75.62318601, -76.25337923,
                                -76.88882405, -77.52956425], 4)

        assert_almost_equal(np.ppmt(0.1/12, list(range(5)), 24, 2000, 0,
            [0, 0, 1, 'end', 'begin']),
                            [-74.998201, -75.62318601, -75.62318601,
                                -76.88882405, -76.88882405], 4) 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:18,代码来源:test_financial.py

示例4: test_ppmt

# 需要导入模块: import numpy [as 别名]
# 或者: from numpy import ppmt [as 别名]
def test_ppmt(self):
        assert_equal(np.round(np.ppmt(0.1 / 12, 1, 60, 55000), 2), -710.25) 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:4,代码来源:test_financial.py

示例5: test_ppmt_decimal

# 需要导入模块: import numpy [as 别名]
# 或者: from numpy import ppmt [as 别名]
def test_ppmt_decimal(self):
        assert_equal(np.ppmt(Decimal('0.1') / Decimal('12'), Decimal('1'), Decimal('60'), Decimal('55000')),
                     Decimal('-710.2541257864217612489830917'))

    # Two tests showing how Decimal is actually getting at a more exact result
    # .23 / 12 does not come out nicely as a float but does as a decimal 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:8,代码来源:test_financial.py

示例6: test_ppmt_special_rate

# 需要导入模块: import numpy [as 别名]
# 或者: from numpy import ppmt [as 别名]
def test_ppmt_special_rate(self):
        assert_equal(np.round(np.ppmt(0.23 / 12, 1, 60, 10000000000), 8), -90238044.232277036) 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:4,代码来源:test_financial.py

示例7: test_ppmt_special_rate_decimal

# 需要导入模块: import numpy [as 别名]
# 或者: from numpy import ppmt [as 别名]
def test_ppmt_special_rate_decimal(self):
        # When rounded out to 8 decimal places like the float based test, this should not equal the same value
        # as the float, substituted for the decimal
        def raise_error_because_not_equal():
            assert_equal(
                round(np.ppmt(Decimal('0.23') / Decimal('12'), 1, 60, Decimal('10000000000')), 8),
                Decimal('-90238044.232277036'))

        assert_raises(AssertionError, raise_error_because_not_equal)
        assert_equal(np.ppmt(Decimal('0.23') / Decimal('12'), 1, 60, Decimal('10000000000')),
                     Decimal('-90238044.2322778884413969909')) 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:13,代码来源:test_financial.py

示例8: _convert_when

# 需要导入模块: import numpy [as 别名]
# 或者: from numpy import ppmt [as 别名]
def _convert_when(when):
    #Test to see if when has already been converted to ndarray
    #This will happen if one function calls another, for example ppmt
    if isinstance(when, np.ndarray):
        return when
    try:
        return _when_to_num[when]
    except (KeyError, TypeError):
        return [_when_to_num[x] for x in when] 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:11,代码来源:financial.py

示例9: ppmt

# 需要导入模块: import numpy [as 别名]
# 或者: from numpy import ppmt [as 别名]
def ppmt(rate, per, nper, pv, fv=0, when='end'):
    """
    Compute the payment against loan principal.

    Parameters
    ----------
    rate : array_like
        Rate of interest (per period)
    per : array_like, int
        Amount paid against the loan changes.  The `per` is the period of
        interest.
    nper : array_like
        Number of compounding periods
    pv : array_like
        Present value
    fv : array_like, optional
        Future value
    when : {{'begin', 1}, {'end', 0}}, {string, int}
        When payments are due ('begin' (1) or 'end' (0))

    See Also
    --------
    pmt, pv, ipmt

    """
    total = pmt(rate, nper, pv, fv, when)
    return total - ipmt(rate, per, nper, pv, fv, when) 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:29,代码来源:financial.py

示例10: test_ppmt

# 需要导入模块: import numpy [as 别名]
# 或者: from numpy import ppmt [as 别名]
def test_ppmt(self):
        np.round(np.ppmt(0.1/12, 1, 60, 55000), 2) == 710.25 
开发者ID:ryfeus,项目名称:lambda-packs,代码行数:4,代码来源:test_financial.py

示例11: ppmt

# 需要导入模块: import numpy [as 别名]
# 或者: from numpy import ppmt [as 别名]
def ppmt(rate, per, nper, pv, fv=0.0, when='end'):
    """
    Compute the payment against loan principal.

    Parameters
    ----------
    rate : array_like
        Rate of interest (per period)
    per : array_like, int
        Amount paid against the loan changes.  The `per` is the period of
        interest.
    nper : array_like
        Number of compounding periods
    pv : array_like
        Present value
    fv : array_like, optional
        Future value
    when : {{'begin', 1}, {'end', 0}}, {string, int}
        When payments are due ('begin' (1) or 'end' (0))

    See Also
    --------
    pmt, pv, ipmt

    """
    total = pmt(rate, nper, pv, fv, when)
    return total - ipmt(rate, per, nper, pv, fv, when) 
开发者ID:abhisuri97,项目名称:auto-alt-text-lambda-api,代码行数:29,代码来源:financial.py


注:本文中的numpy.ppmt方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。