Python numpy.rate() 使用实例

The following are code examples for showing how to use . They are extracted from open source Python projects. You can vote up the examples you like or vote down the exmaples you don’t like. You can also save this page to your account.

Example 1

def test_rate(self):
        assert_almost_equal(np.rate(10, 0, -3500, 10000),
                            0.1107, 4) 

Example 2

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) 

Example 3

def test_rate(self):
        assert_almost_equal(np.rate(10, 0, -3500, 10000),
                            0.1107, 4) 

Example 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) 

Example 5

def test_rate(self):
        assert_almost_equal(np.rate(10, 0, -3500, 10000),
                            0.1107, 4) 

Example 6

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) 

Example 7

def test_rate(self):
        assert_almost_equal(np.rate(10, 0, -3500, 10000),
                            0.1107, 4) 

Example 8

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) 

Example 9

def test_rate(self):
        assert_almost_equal(np.rate(10, 0, -3500, 10000),
                            0.1107, 4) 

Example 10

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) 

Example 11

def test_rate(self):
        assert_almost_equal(np.rate(10, 0, -3500, 10000),
                            0.1107, 4) 

Example 12

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) 
点赞