The ma.masked_all()
function in Python is used to empty a masked array of the given shape and data type with all elements masked.
ma.masked_all(shape, dtype=<class 'float'>)
The ma.masked_all()
function takes the following parameter values:
shape
: This represents the shape of the output masked array.dtype
: This represents the data type of the output array. This is optional.The ma.masked_all()
function returns a masked array where all elements are masked.
import numpy as npimport numpy.ma as ma# implementing the `ma.masked_all()` functionmyarray = ma.masked_all((2,3), dtype=np.float)# printing the arrayprint(myarray)
ma.masked_all()
function using a shape of 2
by 3
and a float
dtype
for the output array. The result is stored in myarray
.myarray
.