Python numpy.rate() Examples
The following are 30
code examples of numpy.rate().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
numpy
, or try the search function
.
Example #1
Source File: test_financial.py From Serverless-Deep-Learning-with-TensorFlow-and-AWS-Lambda with MIT License | 6 votes |
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])
Example #2
Source File: test_financial.py From Mastering-Elasticsearch-7.0 with MIT License | 6 votes |
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])
Example #3
Source File: test_financial.py From coffeegrindsize with MIT License | 6 votes |
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])
Example #4
Source File: test_financial.py From GraphicDesignPatternByPython with MIT License | 6 votes |
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])
Example #5
Source File: test_financial.py From vnpy_crypto with MIT License | 6 votes |
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])
Example #6
Source File: test_financial.py From pySINDy with MIT License | 6 votes |
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])
Example #7
Source File: test_financial.py From twitter-stock-recommendation with MIT License | 6 votes |
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])
Example #8
Source File: test_financial.py From recruit with Apache License 2.0 | 6 votes |
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])
Example #9
Source File: test_financial.py From predictive-maintenance-using-machine-learning with Apache License 2.0 | 6 votes |
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])
Example #10
Source File: test_financial.py From pySINDy with MIT License | 5 votes |
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
Source File: test_financial.py From mxnet-lambda with Apache License 2.0 | 5 votes |
def test_rate(self): assert_almost_equal(np.rate(10, 0, -3500, 10000), 0.1107, 4)
Example #12
Source File: test_financial.py From coffeegrindsize with MIT License | 5 votes |
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 #13
Source File: test_financial.py From mxnet-lambda with Apache License 2.0 | 5 votes |
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 #14
Source File: test_financial.py From ImageFusion with MIT License | 5 votes |
def test_rate(self): assert_almost_equal(np.rate(10, 0, -3500, 10000), 0.1107, 4)
Example #15
Source File: test_financial.py From pySINDy with MIT License | 5 votes |
def test_rate_decimal(self): rate = np.rate(Decimal('10'), Decimal('0'), Decimal('-3500'), Decimal('10000')) assert_equal(Decimal('0.1106908537142689284704528100'), rate)
Example #16
Source File: test_financial.py From elasticintel with GNU General Public License v3.0 | 5 votes |
def test_rate(self): assert_almost_equal(np.rate(10, 0, -3500, 10000), 0.1107, 4)
Example #17
Source File: test_financial.py From elasticintel with GNU General Public License v3.0 | 5 votes |
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 #18
Source File: test_financial.py From coffeegrindsize with MIT License | 5 votes |
def test_rate(self): assert_almost_equal( np.rate(10, 0, -3500, 10000), 0.1107, 4)
Example #19
Source File: test_financial.py From coffeegrindsize with MIT License | 5 votes |
def test_rate_decimal(self): rate = np.rate(Decimal('10'), Decimal('0'), Decimal('-3500'), Decimal('10000')) assert_equal(Decimal('0.1106908537142689284704528100'), rate)
Example #20
Source File: test_financial.py From predictive-maintenance-using-machine-learning with Apache License 2.0 | 5 votes |
def test_rate_decimal(self): rate = np.rate(Decimal('10'), Decimal('0'), Decimal('-3500'), Decimal('10000')) assert_equal(Decimal('0.1106908537142689284704528100'), rate)
Example #21
Source File: test_financial.py From Serverless-Deep-Learning-with-TensorFlow-and-AWS-Lambda with MIT License | 5 votes |
def test_rate(self): assert_almost_equal( np.rate(10, 0, -3500, 10000), 0.1107, 4)
Example #22
Source File: test_financial.py From Serverless-Deep-Learning-with-TensorFlow-and-AWS-Lambda with MIT License | 5 votes |
def test_rate_decimal(self): rate = np.rate(Decimal('10'), Decimal('0'), Decimal('-3500'), Decimal('10000')) assert_equal(Decimal('0.1106908537142689284704528100'), rate)
Example #23
Source File: test_financial.py From Serverless-Deep-Learning-with-TensorFlow-and-AWS-Lambda with MIT License | 5 votes |
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 #24
Source File: test_financial.py From twitter-stock-recommendation with MIT License | 5 votes |
def test_rate(self): assert_almost_equal( np.rate(10, 0, -3500, 10000), 0.1107, 4)
Example #25
Source File: test_financial.py From twitter-stock-recommendation with MIT License | 5 votes |
def test_rate_decimal(self): rate = np.rate(Decimal('10'), Decimal('0'), Decimal('-3500'), Decimal('10000')) assert_equal(Decimal('0.1106908537142689284704528100'), rate)
Example #26
Source File: test_financial.py From twitter-stock-recommendation with MIT License | 5 votes |
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 #27
Source File: test_financial.py From keras-lambda with MIT License | 5 votes |
def test_rate(self): assert_almost_equal(np.rate(10, 0, -3500, 10000), 0.1107, 4)
Example #28
Source File: test_financial.py From keras-lambda with MIT License | 5 votes |
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 #29
Source File: test_financial.py From Mastering-Elasticsearch-7.0 with MIT License | 5 votes |
def test_rate_decimal(self): rate = np.rate(Decimal('10'), Decimal('0'), Decimal('-3500'), Decimal('10000')) assert_equal(Decimal('0.1106908537142689284704528100'), rate)
Example #30
Source File: test_financial.py From recruit with Apache License 2.0 | 5 votes |
def test_rate_decimal(self): rate = np.rate(Decimal('10'), Decimal('0'), Decimal('-3500'), Decimal('10000')) assert_equal(Decimal('0.1106908537142689284704528100'), rate)