numpy.ma.getdata#

ma.getdata(a,subok=True)[source]#

Return the data of a masked array as an ndarray.

Return the data ofa (if any) as an ndarray ifa is aMaskedArray,else returna as a ndarray or subclass (depending onsubok) if not.

Parameters:
aarray_like

InputMaskedArray, alternatively a ndarray or a subclass thereof.

subokbool

Whether to force the output to be apure ndarray (False) or toreturn a subclass of ndarray if appropriate (True, default).

See also

getmask

Return the mask of a masked array, or nomask.

getmaskarray

Return the mask of a masked array, or full array of False.

Examples

>>>importnumpyasnp>>>importnumpy.maasma>>>a=ma.masked_equal([[1,2],[3,4]],2)>>>amasked_array(  data=[[1, --],        [3, 4]],  mask=[[False,  True],        [False, False]],  fill_value=2)>>>ma.getdata(a)array([[1, 2],       [3, 4]])

Equivalently use theMaskedArraydata attribute.

>>>a.dataarray([[1, 2],       [3, 4]])
On this page