EdgeFrame cumulative_sum¶
-
cumulative_sum
(self, sample_col)¶ [BETA] Add column to frame with cumulative percent sum.
Parameters: sample_col : unicode
The name of the column from which to compute the cumulative sum.
A cumulative sum is computed by sequentially stepping through the rows, observing the column values and keeping track of the cumulative sum for each value.
Notes
This method applies only to columns containing numerical data.
Examples
Consider Frame my_frame, which accesses a frame that contains a single column named obs:
>>> my_frame.inspect() [#] obs ======== [0] 0 [1] 1 [2] 2 [3] 0 [4] 1 [5] 2
The cumulative sum for column obs is obtained by:
>>> my_frame.cumulative_sum('obs') [===Job Progress===]
The Frame my_frame accesses the original frame that now contains two columns, obs that contains the original column values, and obsCumulativeSum that contains the cumulative percent count:
>>> my_frame.inspect() [#] obs obs_cumulative_sum ============================ [0] 0 0.0 [1] 1 1.0 [2] 2 3.0 [3] 0 3.0 [4] 1 4.0 [5] 2 6.0