summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornaveenarun <notatroll.troll@gmail.com>2016-09-21 23:31:51 -0500
committerAlec Hodgkinson <Hodgka@rpi.edu>2016-09-23 19:04:14 -0400
commit36f88442209e74f0fcb63ec2aa3868b63f7dafb4 (patch)
tree5ef36cbbf8614ee2b0723423c8ab1dd30c41bdd5
parent04a9eac54dff8f74d6433b25c3cb722ccd98b077 (diff)
downloadnumpy-36f88442209e74f0fcb63ec2aa3868b63f7dafb4.tar.gz
BUG: financial.pmt modifies input #8055
financial.pmt masked rate array in place, changing rate array. Changed to mask to a new array, preserving the original rate array.
-rw-r--r--INSTALL.rst.txt2
-rw-r--r--doc/TESTS.rst.txt2
-rw-r--r--numpy/lib/financial.py7
-rw-r--r--numpy/testing/utils.py2
4 files changed, 7 insertions, 6 deletions
diff --git a/INSTALL.rst.txt b/INSTALL.rst.txt
index 426105929..8b135e309 100644
--- a/INSTALL.rst.txt
+++ b/INSTALL.rst.txt
@@ -34,7 +34,7 @@ Building NumPy requires the following software installed:
This is required for testing numpy, but not for using it.
Python__ http://www.python.org
-nose__ http://somethingaboutorange.com/mrl/projects/nose/
+nose__ http://nose.readthedocs.io
.. note::
diff --git a/doc/TESTS.rst.txt b/doc/TESTS.rst.txt
index 7028ca57a..68b0eace4 100644
--- a/doc/TESTS.rst.txt
+++ b/doc/TESTS.rst.txt
@@ -9,7 +9,7 @@ Introduction
''''''''''''
SciPy uses the `Nose testing system
-<http://www.somethingaboutorange.com/mrl/projects/nose>`__, with some
+<http://nose.readthedocs.io>`__, with some
minor convenience features added. Nose is an extension of the unit
testing framework offered by `unittest.py
<http://docs.python.org/lib/module-unittest.html>`__. Our goal is that
diff --git a/numpy/lib/financial.py b/numpy/lib/financial.py
index 931b0af56..95942da16 100644
--- a/numpy/lib/financial.py
+++ b/numpy/lib/financial.py
@@ -210,9 +210,10 @@ def pmt(rate, nper, pv, fv=0, when='end'):
(rate, nper, pv, fv, when) = map(np.array, [rate, nper, pv, fv, when])
temp = (1 + rate)**nper
mask = (rate == 0.0)
- np.copyto(rate, 1.0, where=mask)
- z = np.zeros(np.broadcast(rate, nper, pv, fv, when).shape)
- fact = np.where(mask != z, nper + z, (1 + rate*when)*(temp - 1)/rate + z)
+ masked_rate = np.where(mask, 1.0, rate)
+ z = np.zeros(np.broadcast(masked_rate, nper, pv, fv, when).shape)
+ fact = np.where(mask != z, nper + z,
+ (1 + masked_rate*when)*(temp - 1)/masked_rate + z)
return -(fv + pv*temp) / fact
def nper(rate, pmt, pv, fv=0, when='end'):
diff --git a/numpy/testing/utils.py b/numpy/testing/utils.py
index 683a4f0a6..cb39a9b4a 100644
--- a/numpy/testing/utils.py
+++ b/numpy/testing/utils.py
@@ -64,7 +64,7 @@ def import_nose():
if not nose_is_good:
msg = ('Need nose >= %d.%d.%d for tests - see '
- 'http://somethingaboutorange.com/mrl/projects/nose' %
+ 'http://nose.readthedocs.io' %
minimum_nose_version)
raise ImportError(msg)