diff options
-rw-r--r-- | numpy/ma/core.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/numpy/ma/core.py b/numpy/ma/core.py index de716a669..9b0b1cc79 100644 --- a/numpy/ma/core.py +++ b/numpy/ma/core.py @@ -3526,6 +3526,8 @@ class MaskedArray(ndarray): def filled(self, fill_value=None): """ Return a copy of self, with masked values filled with a given value. + **However**, if there are no masked values to fill, self will be + returned instead as an ndarray. Parameters ---------- @@ -3537,7 +3539,9 @@ class MaskedArray(ndarray): ------- filled_array : ndarray A copy of ``self`` with invalid entries replaced by *fill_value* - (be it the function argument or the attribute of ``self``. + (be it the function argument or the attribute of ``self``), or + ``self`` itself as an ndarray if there are no invalid entries to + be replaced. Notes ----- |