summaryrefslogtreecommitdiff
path: root/numpy/lib/function_base.py
diff options
context:
space:
mode:
authorpierregm <pierregm@localhost>2010-03-22 01:45:40 +0000
committerpierregm <pierregm@localhost>2010-03-22 01:45:40 +0000
commit6688b8de88a78abe450d0518efd11fc51988cb38 (patch)
treebc05ca67ad7a018965ae867aa67fd561dcc057b9 /numpy/lib/function_base.py
parent5325c7bea41b61436dc9a0497179428fa9903ebb (diff)
downloadnumpy-6688b8de88a78abe450d0518efd11fc51988cb38.tar.gz
* Use putmask instead of fancy indexing in _nanop (bug #1421)
Diffstat (limited to 'numpy/lib/function_base.py')
-rw-r--r--numpy/lib/function_base.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/numpy/lib/function_base.py b/numpy/lib/function_base.py
index 82503a54e..87ecf717e 100644
--- a/numpy/lib/function_base.py
+++ b/numpy/lib/function_base.py
@@ -1282,7 +1282,10 @@ def _nanop(op, fill, a, axis=None):
# We only need to take care of NaN's in floating point arrays
if not np.issubdtype(y.dtype, int):
- y[mask] = fill
+ # y[mask] = fill
+ # We can't use fancy indexing here as it'll mess w/ MaskedArrays
+ # Instead, let's fill the array directly...
+ np.putmask(y, mask, fill)
res = op(y, axis=axis)
mask_all_along_axis = mask.all(axis=axis)