This is a pre-release version (2.5.0.dev0+git20251130.2de293a). Go to latest (2.4.4)
{ } Raw JSON

bundles / numpy 2.5.0.dev0+git20251130.2de293a / numpy / ma / core / set_fill_value

function

numpy.ma.core:set_fill_value

source: build-install/usr/lib/python3.14/site-packages/numpy/ma/core.py :508

Signature

def   set_fill_value ( a fill_value )

Summary

Set the filling value of a, if a is a masked array.

Extended Summary

This function changes the fill value of the masked array a in place. If a is not a masked array, the function returns silently, without doing anything.

Parameters

a : array_like

Input array.

fill_value : dtype

Filling value. A consistency test is performed to make sure the value is compatible with the dtype of a.

Returns

: None

Nothing returned by this function.

Examples

import numpy as np
import numpy.ma as ma
a = np.arange(5)
a
a = ma.masked_where(a < 3, a)
a
ma.set_fill_value(a, -999)
a
Nothing happens if `a` is not a masked array.
a = list(range(5))
a
ma.set_fill_value(a, 100)
a
a = np.arange(5)
a
ma.set_fill_value(a, 100)
a

See also

MaskedArray.fill_value

Return current fill value.

MaskedArray.set_fill_value

Equivalent method.

maximum_fill_value

Return the default fill value for a dtype.

Aliases

  • numpy.ma.set_fill_value