numpy.ma.masked_all()函数| Python
numpy.ma.masked_all()
函数返回给定形状和 dtype 的空掩码数组,其中所有数据都被掩码。
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.
代码#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)
输出 :
[[-- -- -- --]
[-- -- -- --]
[-- -- -- --]
[-- -- -- --]]
代码#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)
输出 :
[[-- -- --]
[-- -- --]
[-- -- --]]