Open In App

numpy.ma.masked_all() function | Python

Last Updated : 05 May, 2020
Improve
Improve
Like Article
Like
Save
Share
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 :




# 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 :




# 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 :

[[-- -- --]
 [-- -- --]
 [-- -- --]]

Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads