diff options
author | Charles Harris <charlesr.harris@gmail.com> | 2013-08-18 20:44:24 -0600 |
---|---|---|
committer | Charles Harris <charlesr.harris@gmail.com> | 2013-08-18 20:44:24 -0600 |
commit | 0858d8a313d2fade35644ba1d1dbfb408041018f (patch) | |
tree | a69a2170fa57c5efac780a5fce8a192a9ad73d97 /numpy/lib/nanfunctions.py | |
parent | 3fe2744e6ff5e9027e01ebd166ae9bfd7aaaa309 (diff) | |
download | numpy-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.py | 13 |
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): |