summaryrefslogtreecommitdiff
path: root/numpy/lib/nanfunctions.py
diff options
context:
space:
mode:
authorEric Wieser <wieser.eric@gmail.com>2017-04-27 23:01:49 +0100
committerEric Wieser <wieser.eric@gmail.com>2017-04-27 23:01:49 +0100
commitc607456d9eac8743e5280adeec5496fd2621ae6a (patch)
tree7f804f13cfc913ee6ff72de9b0fe5d530808dddf /numpy/lib/nanfunctions.py
parente332ba4314bf874b1c7d17d82a2f1bf1766ece69 (diff)
downloadnumpy-c607456d9eac8743e5280adeec5496fd2621ae6a.tar.gz
MAINT: Remove weird create-a-copy dance
Diffstat (limited to 'numpy/lib/nanfunctions.py')
-rw-r--r--numpy/lib/nanfunctions.py8
1 files changed, 2 insertions, 6 deletions
diff --git a/numpy/lib/nanfunctions.py b/numpy/lib/nanfunctions.py
index c96e925aa..d9df9563f 100644
--- a/numpy/lib/nanfunctions.py
+++ b/numpy/lib/nanfunctions.py
@@ -61,14 +61,10 @@ def _replace_nan(a, val):
NaNs, otherwise return None.
"""
- is_new = not isinstance(a, np.ndarray)
- if is_new:
- a = np.array(a)
+ a = np.array(a, subok=True, copy=True)
+
if not issubclass(a.dtype.type, np.inexact):
return a, None
- if not is_new:
- # need copy
- a = np.array(a, subok=True)
mask = np.isnan(a)
np.copyto(a, val, where=mask)