turicreate.SArray.cumulative_mean

SArray.cumulative_mean()

Return the cumulative mean of the elements in the SArray.

Returns an SArray where each element in the output corresponds to the mean value 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[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_mean()
dtype: float
rows: 3
[1, 1.5, 2, 2.5, 3]