numpy.ma.masked_array.fill_value#

property

property ma.masked_array.fill_value#

The filling value of the masked array is a scalar. When setting, None will set to a default based on the data type.

Examples

>>> import numpy as np
>>> for dt in [np.int32, np.int64, np.float64, np.complex128]:
...     np.ma.array([0, 1], dtype=dt).get_fill_value()
...
np.int64(999999)
np.int64(999999)
np.float64(1e+20)
np.complex128(1e+20+0j)
>>> x = np.ma.array([0, 1.], fill_value=-np.inf)
>>> x.fill_value
np.float64(-inf)
>>> x.fill_value = np.pi
>>> x.fill_value
np.float64(3.1415926535897931)

Reset to default:

>>> x.fill_value = None
>>> x.fill_value
np.float64(1e+20)