Open In App

numpy.ma.masked_all() function | Python

Last Updated : 05 May, 2020
Comments
Improve
Suggest changes
Like Article
Like
Report
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 : Python3
# Python program explaining
# numpy.ma.masked_all() function

# importing numpy as geek 
# and numpy.ma module as ma 
import numpy as geek 
import numpy.ma as ma 

gfg = ma.masked_all((4, 4))

print (gfg)
Output :
[[-- -- -- --]
 [-- -- -- --]
 [-- -- -- --]
 [-- -- -- --]]
  Code #2 : Python3
# Python program explaining
# numpy.ma.masked_all() function

# importing numpy as geek 
# and numpy.ma module as ma 
import numpy as geek 
import numpy.ma as ma 

gfg = ma.masked_all((3, 3), dtype = geek.int32)

print (gfg)
Output :
[[-- -- --]
 [-- -- --]
 [-- -- --]]

Next Article

Similar Reads