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


Python numpy.rate方法代码示例

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


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

示例1: test_pmt_decimal

# 需要导入模块: import numpy [as 别名]
# 或者: from numpy import rate [as 别名]
def test_pmt_decimal(self):
        res = np.pmt(Decimal('0.08') / Decimal('12'), 5 * 12, 15000)
        tgt = Decimal('-304.1459143262052370338701494')
        assert_equal(res, tgt)
        # Test the edge case where rate == 0.0
        res = np.pmt(Decimal('0'), Decimal('60'), Decimal('15000'))
        tgt = -250
        assert_equal(res, tgt)
        # Test the case where we use broadcast and
        # the arguments passed in are arrays.
        res = np.pmt([[Decimal('0'), Decimal('0.8')], [Decimal('0.3'), Decimal('0.8')]],
                     [Decimal('12'), Decimal('3')], [Decimal('2000'), Decimal('20000')])
        tgt = np.array([[Decimal('-166.6666666666666666666666667'), Decimal('-19311.25827814569536423841060')],
                        [Decimal('-626.9081401700757748402586600'), Decimal('-19311.25827814569536423841060')]])

        # Cannot use the `assert_allclose` because it uses isfinite under the covers
        # which does not support the Decimal type
        # See issue: https://github.com/numpy/numpy/issues/9954
        assert_equal(res[0][0], tgt[0][0])
        assert_equal(res[0][1], tgt[0][1])
        assert_equal(res[1][0], tgt[1][0])
        assert_equal(res[1][1], tgt[1][1]) 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:24,代码来源:test_financial.py

示例2: test_rate

# 需要导入模块: import numpy [as 别名]
# 或者: from numpy import rate [as 别名]
def test_rate(self):
        assert_almost_equal(
            np.rate(10, 0, -3500, 10000),
            0.1107, 4) 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:6,代码来源:test_financial.py

示例3: test_rate_decimal

# 需要导入模块: import numpy [as 别名]
# 或者: from numpy import rate [as 别名]
def test_rate_decimal(self):
        rate = np.rate(Decimal('10'), Decimal('0'), Decimal('-3500'), Decimal('10000'))
        assert_equal(Decimal('0.1106908537142689284704528100'), rate) 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:5,代码来源:test_financial.py

示例4: test_pmt

# 需要导入模块: import numpy [as 别名]
# 或者: from numpy import rate [as 别名]
def test_pmt(self):
        res = np.pmt(0.08 / 12, 5 * 12, 15000)
        tgt = -304.145914
        assert_allclose(res, tgt)
        # Test the edge case where rate == 0.0
        res = np.pmt(0.0, 5 * 12, 15000)
        tgt = -250.0
        assert_allclose(res, tgt)
        # Test the case where we use broadcast and
        # the arguments passed in are arrays.
        res = np.pmt([[0.0, 0.8], [0.3, 0.8]], [12, 3], [2000, 20000])
        tgt = np.array([[-166.66667, -19311.258], [-626.90814, -19311.258]])
        assert_allclose(res, tgt) 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:15,代码来源:test_financial.py

示例5: test_rate

# 需要导入模块: import numpy [as 别名]
# 或者: from numpy import rate [as 别名]
def test_rate(self):
        assert_almost_equal(np.rate(10, 0, -3500, 10000),
                            0.1107, 4) 
开发者ID:ryfeus,项目名称:lambda-packs,代码行数:5,代码来源:test_financial.py

示例6: test_pmt

# 需要导入模块: import numpy [as 别名]
# 或者: from numpy import rate [as 别名]
def test_pmt(self):
        res = np.pmt(0.08/12, 5*12, 15000)
        tgt = -304.145914
        assert_allclose(res, tgt)
        # Test the edge case where rate == 0.0
        res = np.pmt(0.0, 5*12, 15000)
        tgt = -250.0
        assert_allclose(res, tgt)
        # Test the case where we use broadcast and
        # the arguments passed in are arrays.
        res = np.pmt([[0.0, 0.8],[0.3, 0.8]],[12, 3],[2000, 20000])
        tgt = np.array([[-166.66667, -19311.258],[-626.90814, -19311.258]])
        assert_allclose(res, tgt) 
开发者ID:ryfeus,项目名称:lambda-packs,代码行数:15,代码来源:test_financial.py

示例7: pvfv

# 需要导入模块: import numpy [as 别名]
# 或者: from numpy import rate [as 别名]
def pvfv(pval=None, fval=None, nrate=None, nper=None, pyr=1, noprint=True):
    """Computes the missing argument (set to ``None``) in a model relating the
    present value, the future value, the number of compoundig periods
    and the nominal interest rate in a cashflow.

    Args:
        pval (float, list): Present value.
        fval (float, list): Future value.
        nrate (float, list): Nominal interest rate per year.
        nper (int, list): Number of compounding periods.
        pyr (int, list): number of periods per year.
        noprint (bool): prints enhanced output

    Returns:
        The value of the parameter set to ``None`` in the function call.

    **Details**

    The ``pvfv`` function computes and returns the missing value (``fval``,
    ``pval``, ``nper``, ``nrate``) in a model relating these variables.
    The time intervals between consecutive payments are
    assumed to be equial. For internal computations, the effective interest rate per
    period is calculated as ``nrate / pyr``.

    This function is used to simplify the call to the ``tvmm`` function.
    See the ``tvmm`` function for details.



    """
    return tvmm(pval=pval, fval=fval, pmt=0, nrate=nrate, nper=nper, due=0, pyr=pyr, noprint=noprint) 
开发者ID:jdvelasq,项目名称:cashflows,代码行数:33,代码来源:tvmm.py

示例8: pmtfv

# 需要导入模块: import numpy [as 别名]
# 或者: from numpy import rate [as 别名]
def pmtfv(pmt=None, fval=None, nrate=None, nper=None, pyr=1, noprint=True):
    """Computes the missing argument (set to ``None``) in a model relating the
    the future value, the periodic payment, the number of
    compounding periods and the nominal interest rate in a cashflow.

    Args:
        pmt (float, list): Periodic payment.
        fval (float, list): Future value.
        nrate (float, list): Nominal rate per year.
        nper (int, list): Number of compounding periods.
        pyr (int, list): number of periods per year.
        noprint (bool): prints enhanced output

    Returns:
        The value of the parameter set to None in the function call.

    **Details**

    The ``pmtfv`` function computes and returns the missing value (``pmt``, ``fval``,
    ``nper``, ``nrate``) in a model relating a finite sequence  of payments
    made at the beginning or at the end of each period, a future value,
    and a nominal interest rate. The time intervals between consecutive payments are
    assumed to be equial. For internal computations, the effective interest rate per
    period is calculated as ``nrate / pyr``.

    This function is used to simplify the call to the ``tvmm`` function.
    See the ``tvmm`` function for details.


    """
    return tvmm(pval=0, fval=fval, pmt=pmt, nrate=nrate, nper=nper, due=1, pyr=pyr, noprint=noprint) 
开发者ID:jdvelasq,项目名称:cashflows,代码行数:33,代码来源:tvmm.py

示例9: pvpmt

# 需要导入模块: import numpy [as 别名]
# 或者: from numpy import rate [as 别名]
def pvpmt(pmt=None, pval=None, nrate=None, nper=None, pyr=1, noprint=True):
    """Computes the missing argument (set to ``None``) in a model relating the
    present value, the periodic payment, the number of
    compounding periods and the nominal interest rate in a cashflow.

    Args:
        pmt (float, list): Periodic payment.
        pval (float, list): Present value.
        nrate (float, list): Nominal interest rate per year.
        nper (int, list): Number of compounding periods.
        pyr (int, list): number of periods per year.
        noprint (bool): prints enhanced output

    Returns:
        The value of the parameter set to None in the function call.

    **Details**

    The ``pvpmt`` function computes and returns the missing value (``pmt``,
    ``pval``, ``nper``, ``nrate``) in a model relating a finite sequence  of payments
    made at the beginning or at the end of each period, a present value,
    and a nominal interest rate. The time intervals between consecutive payments are
    assumed to be equial. For internal computations, the effective interest rate per
    period is calculated as ``nrate / pyr``.

    This function is used to simplify the call to the ``tvmm`` function.
    See the ``tvmm`` function for details.

    """
    return tvmm(pval=pval, fval=0, pmt=pmt, nrate=nrate, nper=nper, due=0, pyr=pyr, noprint=noprint) 
开发者ID:jdvelasq,项目名称:cashflows,代码行数:32,代码来源:tvmm.py


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