summaryrefslogtreecommitdiff
path: root/numpy/lib/nanfunctions.py
diff options
context:
space:
mode:
authorCharles Harris <charlesr.harris@gmail.com>2014-07-06 23:49:41 -0600
committerCharles Harris <charlesr.harris@gmail.com>2014-07-06 23:49:41 -0600
commitdc98a3df98645c2d074ee18ccc8357384e208f02 (patch)
tree9c02c55ef617c80f5bd27f6b06325b89db7abce8 /numpy/lib/nanfunctions.py
parent594b0de1f09fde18c9c786994d7146a99f35e7d0 (diff)
parentd1422d35d7ad70ebb2c7e41eadd14f27f8cc7e31 (diff)
downloadnumpy-dc98a3df98645c2d074ee18ccc8357384e208f02.tar.gz
Merge pull request #4671 from charris/prepare-1.10-devel
MAINT: start 1.10-devel.
Diffstat (limited to 'numpy/lib/nanfunctions.py')
-rw-r--r--numpy/lib/nanfunctions.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/numpy/lib/nanfunctions.py b/numpy/lib/nanfunctions.py
index 7120760b5..d695245d4 100644
--- a/numpy/lib/nanfunctions.py
+++ b/numpy/lib/nanfunctions.py
@@ -35,6 +35,10 @@ def _replace_nan(a, val):
marking the locations where NaNs were present. If `a` is not of
inexact type, do nothing and return `a` together with a mask of None.
+ Note that scalars will end up as array scalars, which is important
+ for using the result as the value of the out argument in some
+ operations.
+
Parameters
----------
a : array-like
@@ -1039,7 +1043,7 @@ def nanvar(a, axis=None, dtype=None, out=None, ddof=0, keepdims=False):
avg = _divide_by_count(avg, cnt)
# Compute squared deviation from mean.
- arr -= avg
+ np.subtract(arr, avg, out=arr, casting='unsafe')
arr = _copyto(arr, 0, mask)
if issubclass(arr.dtype.type, np.complexfloating):
sqr = np.multiply(arr, arr.conj(), out=arr).real