原文:https://docs.scipy.org/doc/numpy/reference/generated/numpy.ma.MaskedArray.astype.html
校对:(虚位以待)
MaskedArray.
astype
(newtype)[source]将MaskedArray转换的副本返回给给定的newtype。
返回: | 输出:MaskedArray
|
---|
例子
>>> x = np.ma.array([[1,2,3.1],[4,5,6],[7,8,9]], mask=[0] + [1,0]*4)
>>> print(x)
[[1.0 -- 3.1]
[-- 5.0 --]
[7.0 -- 9.0]]
>>> print(x.astype(int32))
[[1 -- 3]
[-- 5 --]
[7 -- 9]]