From 0858d8a313d2fade35644ba1d1dbfb408041018f Mon Sep 17 00:00:00 2001 From: Charles Harris Date: Sun, 18 Aug 2013 20:44:24 -0600 Subject: 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. --- numpy/lib/nanfunctions.py | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) (limited to 'numpy/lib/nanfunctions.py') 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): -- cgit v1.2.1