You are viewing an older version (2.4.3). Go to latest (2.4.4)
{ } Raw JSON

bundles / numpy 2.4.3 / numpy / ma / extras / masked_all

function

numpy.ma.extras:masked_all

source: /numpy/ma/extras.py :120

Signature

def   masked_all ( shape dtype = <class 'float'> )

Summary

Empty masked array with all elements masked.

Extended Summary

Return an empty masked array of the given shape and dtype, where all the data are masked.

Parameters

shape : int or tuple of ints

Shape of the required MaskedArray, e.g., (2, 3) or 2.

dtype : dtype, optional

Data type of the output.

Returns

a : MaskedArray

A masked array with all data masked.

Notes

Unlike other masked array creation functions (e.g. numpy.ma.zeros, numpy.ma.ones, numpy.ma.full), masked_all does not initialize the values of the array, and may therefore be marginally faster. However, the values stored in the newly allocated array are arbitrary. For reproducible behavior, be sure to set each element of the array before reading.

Examples

import numpy as np
np.ma.masked_all((3, 3))
The `dtype` parameter defines the underlying data type.
a = np.ma.masked_all((3, 3))
a.dtype
a = np.ma.masked_all((3, 3), dtype=np.int32)
a.dtype

See also

masked_all_like

Empty masked array modelled on an existing array.

Aliases

  • numpy.ma.masked_all