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


Python numpy.pv方法代码示例

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


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

示例1: levelize_costs

# 需要导入模块: import numpy [as 别名]
# 或者: from numpy import pv [as 别名]
def levelize_costs(self):
        if hasattr(self, 'is_levelized'):
            inflation = cfg.getParamAsFloat('inflation_rate')
            try:
                rate = self.cost_of_capital - inflation
            except:
                pdb.set_trace()
            if self.is_levelized == 0:
                self.values_level = - np.pmt(rate, self.book_life, 1, 0, 'end') * self.values
                util.convert_age(self, vintages=self.vintages, years=self.years, attr_from='values_level', attr_to='values_level', reverse=False)
            elif self.is_levelized==1:
                self.values_level = self.values.copy()
                util.convert_age(self, vintages=self.vintages, years=self.years, attr_from='values_level', attr_to='values_level', reverse=False)
                self.values = np.pv(rate, self.book_life, -1, 0, 'end') * self.values
            elif self.definition == 'relative':
                self.values_level = self.values.copy()
                util.convert_age(self, vintages=self.vintages, years=self.years, attr_from='values_level', attr_to='values_level', reverse=False)
            else:
                raise ValueError("no specification of whether the technology cost is levelized")

        else:
            raise ValueError('Supply Technology id %s needs to indicate whether costs are levelized ' %self.name) 
开发者ID:energyPATHWAYS,项目名称:EnergyPATHWAYS,代码行数:24,代码来源:supply_technologies.py

示例2: test_pv

# 需要导入模块: import numpy [as 别名]
# 或者: from numpy import pv [as 别名]
def test_pv(self):
        assert_almost_equal(np.pv(0.07, 20, 12000, 0), -127128.17, 2) 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:4,代码来源:test_financial.py

示例3: test_pv_decimal

# 需要导入模块: import numpy [as 别名]
# 或者: from numpy import pv [as 别名]
def test_pv_decimal(self):
        assert_equal(np.pv(Decimal('0.07'), Decimal('20'), Decimal('12000'), Decimal('0')),
                     Decimal('-127128.1709461939327295222005')) 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:5,代码来源:test_financial.py

示例4: _fv_dispatcher

# 需要导入模块: import numpy [as 别名]
# 或者: from numpy import pv [as 别名]
def _fv_dispatcher(rate, nper, pmt, pv, when=None):
    return (rate, nper, pmt, pv) 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:4,代码来源:financial.py

示例5: _pmt_dispatcher

# 需要导入模块: import numpy [as 别名]
# 或者: from numpy import pv [as 别名]
def _pmt_dispatcher(rate, nper, pv, fv=None, when=None):
    return (rate, nper, pv, fv) 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:4,代码来源:financial.py

示例6: _nper_dispatcher

# 需要导入模块: import numpy [as 别名]
# 或者: from numpy import pv [as 别名]
def _nper_dispatcher(rate, pmt, pv, fv=None, when=None):
    return (rate, pmt, pv, fv) 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:4,代码来源:financial.py

示例7: _rbl

# 需要导入模块: import numpy [as 别名]
# 或者: from numpy import pv [as 别名]
def _rbl(rate, per, pmt, pv, when):
    """
    This function is here to simply have a different name for the 'fv'
    function to not interfere with the 'fv' keyword argument within the 'ipmt'
    function.  It is the 'remaining balance on loan' which might be useful as
    it's own function, but is easily calculated with the 'fv' function.
    """
    return fv(rate, (per - 1), pmt, pv, when) 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:10,代码来源:financial.py

示例8: _ppmt_dispatcher

# 需要导入模块: import numpy [as 别名]
# 或者: from numpy import pv [as 别名]
def _ppmt_dispatcher(rate, per, nper, pv, fv=None, when=None):
    return (rate, per, nper, pv, fv) 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:4,代码来源:financial.py

示例9: ppmt

# 需要导入模块: import numpy [as 别名]
# 或者: from numpy import pv [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: _pv_dispatcher

# 需要导入模块: import numpy [as 别名]
# 或者: from numpy import pv [as 别名]
def _pv_dispatcher(rate, nper, pmt, fv=None, when=None):
    return (rate, nper, nper, pv, fv) 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:4,代码来源:financial.py

示例11: _rate_dispatcher

# 需要导入模块: import numpy [as 别名]
# 或者: from numpy import pv [as 别名]
def _rate_dispatcher(nper, pmt, pv, fv, when=None, guess=None, tol=None,
                     maxiter=None):
    return (nper, pmt, pv, fv)


# Use Newton's iteration until the change is less than 1e-6
#  for all values or a maximum of 100 iterations is reached.
#  Newton's rule is
#  r_{n+1} = r_{n} - g(r_n)/g'(r_n)
#     where
#  g(r) is the formula
#  g'(r) is the derivative with respect to r. 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:14,代码来源:financial.py

示例12: ppmt

# 需要导入模块: import numpy [as 别名]
# 或者: from numpy import pv [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:ryfeus,项目名称:lambda-packs,代码行数:29,代码来源:financial.py

示例13: test_pv

# 需要导入模块: import numpy [as 别名]
# 或者: from numpy import pv [as 别名]
def test_pv(self):
        assert_almost_equal(np.pv(0.07, 20, 12000, 0),
                            -127128.17, 2) 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:5,代码来源:test_financial.py


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