turicreate.SArray.cumulative_sum¶
-
SArray.
cumulative_sum
()¶ Return the cumulative sum of the elements in the SArray.
Returns an SArray where each element in the output corresponds to the sum of all the elements preceding and including it. The SArray is expected to be of numeric type (int, float), or a numeric vector type.
Returns: - out : sarray[int, float, array.array]
Notes
- Missing values are ignored while performing the cumulative aggregate operation.
- For SArray’s of type array.array, all entries are expected to be of the same size.
Examples
>>> sa = SArray([1, 2, 3, 4, 5]) >>> sa.cumulative_sum() dtype: int rows: 3 [1, 3, 6, 10, 15]