This is a pre-release version (latest). Go to latest (2.4.4)
{ } Raw JSON

bundles / numpy latest / numpy / ma / core / cumsum

function

numpy.ma.core:cumsum

source: build-install/usr/lib/python3.14/site-packages/numpy/ma/core.py :7063

Signature

def   cumsum ( self axis = None dtype = None out = None )

Summary

Return the cumulative sum of the array elements over the given axis.

Extended Summary

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.

Notes

The mask is lost if out is not a valid ma.MaskedArray !

Arithmetic is modular when using integer types, and no error is raised on overflow.

Examples

import numpy as np
marr = np.ma.array(np.arange(10), mask=[0,0,0,1,1,1,0,0,0,0])
marr.cumsum()

See also

numpy.cumsum

equivalent function

numpy.ndarray.cumsum

corresponding function for ndarrays

Aliases

  • numpy.ma.cumsum