numpy.ma.cumsum#
- ma.cumsum(self,axis=None,dtype=None,out=None)=<numpy.ma.core._frommethodobject>#
Return the cumulative sum of the array elements over the given axis.
Masked values are set to 0 internally during the computation.However, their position is saved, and the result will be masked atthe same locations.
Refer to
numpy.cumsumfor full documentation.See also
numpy.ndarray.cumsumcorresponding function for ndarrays
numpy.cumsumequivalent function
Notes
The mask is lost ifout is not a valid
ma.MaskedArray!Arithmetic is modular when using integer types, and no error israised on overflow.
Examples
>>>importnumpyasnp>>>marr=np.ma.array(np.arange(10),mask=[0,0,0,1,1,1,0,0,0,0])>>>marr.cumsum()masked_array(data=[0, 1, 3, --, --, --, 9, 16, 24, 33], mask=[False, False, False, True, True, True, False, False, False, False], fill_value=999999)
On this page