summaryrefslogtreecommitdiff
path: root/numpy/lib/nanfunctions.py
diff options
context:
space:
mode:
authorCharles Harris <charlesr.harris@gmail.com>2013-08-18 20:44:24 -0600
committerCharles Harris <charlesr.harris@gmail.com>2013-08-18 20:44:24 -0600
commit0858d8a313d2fade35644ba1d1dbfb408041018f (patch)
treea69a2170fa57c5efac780a5fce8a192a9ad73d97 /numpy/lib/nanfunctions.py
parent3fe2744e6ff5e9027e01ebd166ae9bfd7aaaa309 (diff)
downloadnumpy-0858d8a313d2fade35644ba1d1dbfb408041018f.tar.gz
DEP: Make nansum return 0 for all-NaN or empty axis.
Make this happen and remove test parts dependent on numpy version < 1.9. Fixes test failures in numpy after 1.8 branch.
Diffstat (limited to 'numpy/lib/nanfunctions.py')
-rw-r--r--numpy/lib/nanfunctions.py13
1 files changed, 1 insertions, 12 deletions
diff --git a/numpy/lib/nanfunctions.py b/numpy/lib/nanfunctions.py
index 81f5aee2e..818119eee 100644
--- a/numpy/lib/nanfunctions.py
+++ b/numpy/lib/nanfunctions.py
@@ -478,18 +478,7 @@ def nansum(a, axis=None, dtype=None, out=None, keepdims=0):
"""
a, mask = _replace_nan(a, 0)
- # In version 1.9 uncomment the following line and delete the rest.
- #return a.sum(axis, dtype, out, keepdims)
- warnings.warn("In Numpy 1.9 the sum along empty slices will be zero.",
- FutureWarning)
-
- if mask is None:
- return a.sum(axis, dtype, out, keepdims)
- mask = mask.all(axis, keepdims=keepdims)
- tot = np.add.reduce(a, axis, dtype, out, keepdims)
- if mask.any():
- tot = _copyto(tot, np.nan, mask)
- return tot
+ return a.sum(axis, dtype, out, keepdims)
def nanmean(a, axis=None, dtype=None, out=None, keepdims=False):