我们从Python开源项目中,提取了以下12个代码示例,用于说明如何使用numpy.rate()。
def test_rate(self): assert_almost_equal(np.rate(10, 0, -3500, 10000), 0.1107, 4)
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)