MCPcopy Create free account
hub / github.com/numpy/numpy / MaskedArray

Class MaskedArray

numpy/ma/core.py:2697–6332  ·  view source on GitHub ↗

An array class with possibly masked values. 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, ha

Source from the content-addressed store, hash-verified

2695
2696
2697class MaskedArray(ndarray):
2698 """
2699 An array class with possibly masked values.
2700
2701 Masked values of True exclude the corresponding element from any
2702 computation.
2703
2704 Construction::
2705
2706 x = MaskedArray(data, mask=nomask, dtype=None, copy=False, subok=True,
2707 ndmin=0, fill_value=None, keep_mask=True, hard_mask=None,
2708 shrink=True, order=None)
2709
2710 Parameters
2711 ----------
2712 data : array_like
2713 Input data.
2714 mask : sequence, optional
2715 Mask. Must be convertible to an array of booleans with the same
2716 shape as `data`. True indicates a masked (i.e. invalid) data.
2717 dtype : dtype, optional
2718 Data type of the output.
2719 If `dtype` is None, the type of the data argument (``data.dtype``)
2720 is used. If `dtype` is not None and different from ``data.dtype``,
2721 a copy is performed.
2722 copy : bool, optional
2723 Whether to copy the input data (True), or to use a reference instead.
2724 Default is False.
2725 subok : bool, optional
2726 Whether to return a subclass of `MaskedArray` if possible (True) or a
2727 plain `MaskedArray`. Default is True.
2728 ndmin : int, optional
2729 Minimum number of dimensions. Default is 0.
2730 fill_value : scalar, optional
2731 Value used to fill in the masked values when necessary.
2732 If None, a default based on the data-type is used.
2733 keep_mask : bool, optional
2734 Whether to combine `mask` with the mask of the input data, if any
2735 (True), or to use only `mask` for the output (False). Default is True.
2736 hard_mask : bool, optional
2737 Whether to use a hard mask or not. With a hard mask, masked values
2738 cannot be unmasked. Default is False.
2739 shrink : bool, optional
2740 Whether to force compression of an empty mask. Default is True.
2741 order : {'C', 'F', 'A'}, optional
2742 Specify the order of the array. If order is 'C', then the array
2743 will be in C-contiguous order (last-index varies the fastest).
2744 If order is 'F', then the returned array will be in
2745 Fortran-contiguous order (first-index varies the fastest).
2746 If order is 'A' (default), then the returned array may be
2747 in any order (either C-, Fortran-contiguous, or even discontiguous),
2748 unless a copy is required, in which case it will be C-contiguous.
2749
2750 Examples
2751 --------
2752
2753 The ``mask`` can be initialized with an array of boolean values
2754 with the same shape as ``data``.

Callers 5

__getitem__Method · 0.85
__new__Method · 0.85
arrayFunction · 0.85

Calls 1

_arraymethodFunction · 0.85

Tested by 2