diff options
author | Sebastian Berg <sebastian@sipsolutions.net> | 2022-10-05 19:09:56 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-05 19:09:56 +0200 |
commit | 02b68f16efaff733e77a12c67ea888dba6827720 (patch) | |
tree | aa7e5b339ba25234b3b163642f407e06fe782026 /numpy/ma/core.py | |
parent | 110d75ddc86ad49b1fc9207b201c93eed431d22b (diff) | |
parent | 4213779a4a1108f5908a51dd96ed468057f2c1f2 (diff) | |
download | numpy-02b68f16efaff733e77a12c67ea888dba6827720.tar.gz |
Merge pull request #22046 from cmarmo/masked-invalid
BUG: Make `mask_invalid` consistent with `mask_where` if `copy` is set to `False`
Diffstat (limited to 'numpy/ma/core.py')
-rw-r--r-- | numpy/ma/core.py | 14 |
1 files changed, 1 insertions, 13 deletions
diff --git a/numpy/ma/core.py b/numpy/ma/core.py index 313445be7..0ee630a97 100644 --- a/numpy/ma/core.py +++ b/numpy/ma/core.py @@ -2356,20 +2356,8 @@ def masked_invalid(a, copy=True): fill_value=1e+20) """ - a = np.array(a, copy=copy, subok=True) - mask = getattr(a, '_mask', None) - if mask is not None: - condition = ~(np.isfinite(getdata(a))) - if mask is not nomask: - condition |= mask - cls = type(a) - else: - condition = ~(np.isfinite(a)) - cls = MaskedArray - result = a.view(cls) - result._mask = condition - return result + return masked_where(~(np.isfinite(getdata(a))), a, copy=copy) ############################################################################### # Printing options # |