dask 2021.10.0

Parameters
masked_array(data, mask=False, fill_value=None, **kwargs)

This docstring was copied from numpy.ma.masked_array.

Some inconsistencies with the Dask version may exist.

Masked values of True exclude the corresponding element from any computation.

Construction:

x = MaskedArray(data, mask=nomask, dtype=None, copy=False, subok=True,
                ndmin=0, fill_value=None, keep_mask=True, hard_mask=None,
                shrink=True, order=None)

Parameters

data : array_like

Input data.

mask : sequence, optional

Mask. Must be convertible to an array of booleans with the same shape as :None:None:`data`. True indicates a masked (i.e. invalid) data.

dtype : dtype, optional (Not supported in Dask)

Data type of the output. If :None:None:`dtype` is None, the type of the data argument ( data.dtype ) is used. If :None:None:`dtype` is not None and different from data.dtype , a copy is performed.

copy : bool, optional (Not supported in Dask)

Whether to copy the input data (True), or to use a reference instead. Default is False.

subok : bool, optional (Not supported in Dask)

Whether to return a subclass of :None:None:`MaskedArray` if possible (True) or a plain :None:None:`MaskedArray`. Default is True.

ndmin : int, optional (Not supported in Dask)

Minimum number of dimensions. Default is 0.

fill_value : scalar, optional

Value used to fill in the masked values when necessary. If None, a default based on the data-type is used.

keep_mask : bool, optional (Not supported in Dask)

Whether to combine :None:None:`mask` with the mask of the input data, if any (True), or to use only :None:None:`mask` for the output (False). Default is True.

hard_mask : bool, optional (Not supported in Dask)

Whether to use a hard mask or not. With a hard mask, masked values cannot be unmasked. Default is False.

shrink : bool, optional (Not supported in Dask)

Whether to force compression of an empty mask. Default is True.

order : {'C', 'F', 'A'}, optional (Not supported in Dask)

Specify the order of the array. If order is 'C', then the array will be in C-contiguous order (last-index varies the fastest). If order is 'F', then the returned array will be in Fortran-contiguous order (first-index varies the fastest). If order is 'A' (default), then the returned array may be in any order (either C-, Fortran-contiguous, or even discontiguous), unless a copy is required, in which case it will be C-contiguous.

An array class with possibly masked values.

Examples

The mask can be initialized with an array of boolean values with the same shape as data .

This example is valid syntax, but we were not able to check execution
>>> data = np.arange(6).reshape((2, 3))  # doctest: +SKIP
... np.ma.MaskedArray(data, mask=[[False, True, False], # doctest: +SKIP
...  [False, False, True]]) masked_array( data=[[0, --, 2], [3, 4, --]], mask=[[False, True, False], [False, False, True]], fill_value=999999)

Alternatively, the mask can be initialized to homogeneous boolean array with the same shape as data by passing in a scalar boolean value:

This example is valid syntax, but we were not able to check execution
>>> np.ma.MaskedArray(data, mask=False)  # doctest: +SKIP
masked_array(
  data=[[0, 1, 2],
        [3, 4, 5]],
  mask=[[False, False, False],
        [False, False, False]],
  fill_value=999999)
This example is valid syntax, but we were not able to check execution
>>> np.ma.MaskedArray(data, mask=True)  # doctest: +SKIP
masked_array(
  data=[[--, --, --],
        [--, --, --]],
  mask=[[ True,  True,  True],
        [ True,  True,  True]],
  fill_value=999999,
  dtype=int64)
note

The recommended practice for initializing mask with a scalar boolean value is to use True / False rather than np.True_ / np.False_ . The reason is :None:attr:`nomask` is represented internally as np.False_ .

>>> np.False_ is np.ma.nomask  # doctest: +SKIP
True
See :

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


File: /dask/array/ma.py#122
type: <class 'function'>
Commit: