numpy.ma.MaskedArray.filled

MaskedArray.filled(fill_value=None)

Return a copy of self, where masked values are filled with fill_value.

If fill_value is None, self.fill_value is used instead.

Notes

  • Subclassing is preserved
  • The result is NOT a MaskedArray !

Examples

>>> x = np.ma.array([1,2,3,4,5], mask=[0,0,1,0,1], fill_value=-999)
>>> x.filled()
array([1,2,-999,4,-999])
>>> type(x.filled())
<type 'numpy.ndarray'>

Previous topic

numpy.ma.MaskedArray.compressed

Next topic

numpy.ma.MaskedArray.tofile

This Page

Quick search