MCPcopy Index your code
hub / github.com/numpy/numpy / fill_value

Method fill_value

numpy/ma/core.py:3793–3832  ·  view source on GitHub ↗

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

(self)

Source from the content-addressed store, hash-verified

3791
3792 @property
3793 def fill_value(self):
3794 """
3795 The filling value of the masked array is a scalar. When setting, None
3796 will set to a default based on the data type.
3797
3798 Examples
3799 --------
3800 >>> import numpy as np
3801 >>> for dt in [np.int32, np.int64, np.float64, np.complex128]:
3802 ... np.ma.array([0, 1], dtype=dt).get_fill_value()
3803 ...
3804 np.int64(999999)
3805 np.int64(999999)
3806 np.float64(1e+20)
3807 np.complex128(1e+20+0j)
3808
3809 >>> x = np.ma.array([0, 1.], fill_value=-np.inf)
3810 >>> x.fill_value
3811 np.float64(-inf)
3812 >>> x.fill_value = np.pi
3813 >>> x.fill_value
3814 np.float64(3.1415926535897931)
3815
3816 Reset to default:
3817
3818 >>> x.fill_value = None
3819 >>> x.fill_value
3820 np.float64(1e+20)
3821
3822 """
3823 if self._fill_value is None:
3824 self._fill_value = _check_fill_value(None, self.dtype)
3825
3826 # Temporary workaround to account for the fact that str and bytes
3827 # scalars cannot be indexed with (), whereas all other numpy
3828 # scalars can. See issues #7259 and #7267.
3829 # The if-block can be removed after #7267 has been fixed.
3830 if isinstance(self._fill_value, ndarray):
3831 return self._fill_value[()]
3832 return self._fill_value
3833
3834 @fill_value.setter
3835 def fill_value(self, value=None):

Callers

nothing calls this directly

Calls 1

_check_fill_valueFunction · 0.85

Tested by

no test coverage detected