larray.Array.cumsum
- Array.cumsum(axis=-1) Union[Array, bool, int, float, str, bytes, generic] [source]
Return the cumulative sum of array elements along an axis.
- Parameters
- axisint or str or Axis, optional
Axis along which to perform the cumulative sum. If given as position, it can be a negative integer, in which case it counts from the last to the first axis. By default, the cumulative sum is performed along the last axis.
- Returns
- Array or scalar
See also
Notes
Cumulative aggregation functions accept only one axis
Examples
>>> arr = ndtest((4, 4)) >>> arr a\b b0 b1 b2 b3 a0 0 1 2 3 a1 4 5 6 7 a2 8 9 10 11 a3 12 13 14 15 >>> arr.cumsum() a\b b0 b1 b2 b3 a0 0 1 3 6 a1 4 9 15 22 a2 8 17 27 38 a3 12 25 39 54 >>> arr.cumsum('a') a\b b0 b1 b2 b3 a0 0 1 2 3 a1 4 6 8 10 a2 12 15 18 21 a3 24 28 32 36