numpy.ma.masked_all() function | Python
Last Updated :
05 May, 2020
numpy.ma.masked_all()
function return an empty masked array of the given shape and dtype, where all the data are masked.
Syntax : numpy.ma.masked_all(shape, dtype)
Parameter :
shape : [tuple] Shape of the required MaskedArray.
dtype : [dtype, optional] Data type of the output.
Return : [MaskedArray] A masked array with all data masked.
Code #1 :
import numpy as geek
import numpy.ma as ma
gfg = ma.masked_all(( 4 , 4 ))
print (gfg)
|
Output :
[[-- -- -- --]
[-- -- -- --]
[-- -- -- --]
[-- -- -- --]]
Code #2 :
import numpy as geek
import numpy.ma as ma
gfg = ma.masked_all(( 3 , 3 ), dtype = geek.int32)
print (gfg)
|
Output :
[[-- -- --]
[-- -- --]
[-- -- --]]
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...