本文整理汇总了Python中numpy.ipmt方法的典型用法代码示例。如果您正苦于以下问题:Python numpy.ipmt方法的具体用法?Python numpy.ipmt怎么用?Python numpy.ipmt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类numpy
的用法示例。
在下文中一共展示了numpy.ipmt方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_broadcast
# 需要导入模块: import numpy [as 别名]
# 或者: from numpy import ipmt [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)
示例2: test_broadcast
# 需要导入模块: import numpy [as 别名]
# 或者: from numpy import ipmt [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)
示例3: test_broadcast
# 需要导入模块: import numpy [as 别名]
# 或者: from numpy import ipmt [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)
示例4: test_ipmt
# 需要导入模块: import numpy [as 别名]
# 或者: from numpy import ipmt [as 别名]
def test_ipmt(self):
assert_almost_equal(np.round(np.ipmt(0.1 / 12, 1, 24, 2000), 2), -16.67)
示例5: test_ipmt_decimal
# 需要导入模块: import numpy [as 别名]
# 或者: from numpy import ipmt [as 别名]
def test_ipmt_decimal(self):
result = np.ipmt(Decimal('0.1') / Decimal('12'), 1, 24, 2000)
assert_equal(result.flat[0], Decimal('-16.66666666666666666666666667'))
示例6: test_broadcast_decimal
# 需要导入模块: import numpy [as 别名]
# 或者: from numpy import ipmt [as 别名]
def test_broadcast_decimal(self):
# Use almost equal because precision is tested in the explicit tests, this test is to ensure
# broadcast with Decimal is not broken.
assert_almost_equal(np.ipmt(Decimal('0.1') / Decimal('12'), list(range(5)), Decimal('24'), Decimal('2000')),
[Decimal('-17.29165168'), Decimal('-16.66666667'), Decimal('-16.03647345'),
Decimal('-15.40102862'), Decimal('-14.76028842')], 4)
assert_almost_equal(np.ppmt(Decimal('0.1') / Decimal('12'), list(range(5)), Decimal('24'), Decimal('2000')),
[Decimal('-74.998201'), Decimal('-75.62318601'), Decimal('-76.25337923'),
Decimal('-76.88882405'), Decimal('-77.52956425')], 4)
assert_almost_equal(np.ppmt(Decimal('0.1') / Decimal('12'), list(range(5)), Decimal('24'), Decimal('2000'),
Decimal('0'), [Decimal('0'), Decimal('0'), Decimal('1'), 'end', 'begin']),
[Decimal('-74.998201'), Decimal('-75.62318601'), Decimal('-75.62318601'),
Decimal('-76.88882405'), Decimal('-76.88882405')], 4)
示例7: _rbl
# 需要导入模块: import numpy [as 别名]
# 或者: from numpy import ipmt [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)
示例8: ppmt
# 需要导入模块: import numpy [as 别名]
# 或者: from numpy import ipmt [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)
示例9: test_ipmt
# 需要导入模块: import numpy [as 别名]
# 或者: from numpy import ipmt [as 别名]
def test_ipmt(self):
np.round(np.ipmt(0.1/12, 1, 24, 2000), 2) == 16.67
示例10: ppmt
# 需要导入模块: import numpy [as 别名]
# 或者: from numpy import ipmt [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)