diff options
author | Eric Wieser <wieser.eric@gmail.com> | 2017-04-27 23:01:49 +0100 |
---|---|---|
committer | Eric Wieser <wieser.eric@gmail.com> | 2017-04-27 23:01:49 +0100 |
commit | c607456d9eac8743e5280adeec5496fd2621ae6a (patch) | |
tree | 7f804f13cfc913ee6ff72de9b0fe5d530808dddf /numpy/lib/nanfunctions.py | |
parent | e332ba4314bf874b1c7d17d82a2f1bf1766ece69 (diff) | |
download | numpy-c607456d9eac8743e5280adeec5496fd2621ae6a.tar.gz |
MAINT: Remove weird create-a-copy dance
Diffstat (limited to 'numpy/lib/nanfunctions.py')
-rw-r--r-- | numpy/lib/nanfunctions.py | 8 |
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) |