numpy.ma.masked_array.cumsum
method
-
masked_array.cumsum(self, axis=None, dtype=None, out=None)
[source] -
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 at the same locations.
Refer to
numpy.cumsum
for full documentation.See also
-
numpy.ndarray.cumsum
-
corresponding function for ndarrays
-
numpy.cumsum
-
equivalent function
Notes
The mask is lost if
out
is not a validMaskedArray
!Arithmetic is modular when using integer types, and no error is raised on overflow.
Examples
>>> 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)
-
© 2005–2020 NumPy Developers
Licensed under the 3-clause BSD License.
https://numpy.org/doc/1.19/reference/generated/numpy.ma.masked_array.cumsum.html