Thursday, June 11, 2026
HomeLanguagesnumpy.ma.masked_all_like() function | Python

numpy.ma.masked_all_like() function | Python

numpy.ma.masked_all_like() function return an empty masked array of the same shape and dtype as the array arr, where all the data are masked.

Syntax : numpy.ma.masked_all_like(arr)

Parameter :
arr : [ndarray] An array describing the shape and dtype of the required MaskedArray.

Return : [MaskedArray] A masked array with all data masked.

Code #1 :




# Python program explaining
# numpy.ma.masked_all_like() function
  
# importing numpy as geek 
# and numpy.ma module as ma 
import numpy as geek 
import numpy.ma as ma 
  
arr = geek.zeros((4, 4), dtype = geek.float32)
  
gfg = ma.masked_all_like(arr)
  
print (gfg)


Output :

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

 
Code #2 :




# Python program explaining
# numpy.ma.masked_all_like() function
  
# importing numpy as geek 
# and numpy.ma module as ma 
import numpy as geek 
import numpy.ma as ma 
  
arr = geek.zeros((4, 3), dtype = geek.float32)
  
gfg = ma.masked_all_like(arr)
  
print (gfg)


Output :

[[-- -- --]
 [-- -- --]
 [-- -- --]
 [-- -- --]]
Dominic
Dominichttp://wardslaus.com
infosec,malicious & dos attacks generator, boot rom exploit philanthropist , wild hacker , game developer,
RELATED ARTICLES

Most Popular

Dominic
32515 POSTS0 COMMENTS
Milvus
131 POSTS0 COMMENTS
Nango Kala
6897 POSTS0 COMMENTS
Nicole Veronica
12013 POSTS0 COMMENTS
Nokonwaba Nkukhwana
12109 POSTS0 COMMENTS
Shaida Kate Naidoo
7019 POSTS0 COMMENTS
Ted Musemwa
7262 POSTS0 COMMENTS
Thapelo Manthata
6976 POSTS0 COMMENTS
Umr Jansen
6963 POSTS0 COMMENTS