The following list shows a set of handy functions:


CUT

cut(col_name, cut_point, interval, span_num)

CUT function converts values in col_name into different intervals.

  • cut_point specifies the break point where the intervals are spanned into both sides from the break point.
  • interval denotes the size of each interval.
  • span_num specifies the number of intervals for each side from the cut point. The default value is 3.

For example, cut(data, 5, 2, 2) will convert value in data column into intervals (-,1], (1,3], (3,5], (5,7], (7,9], (9,-].


CUMSUM

cumsum(data, [group])

CUMSUM returns the cumulative sum of data for each group. Note that it is assumed that table is in order by the group column. If group is not given, the whole table is deemed as one group.


DIFF

diff(data, [group])

DIFF function calculates the difference of data between current row and previous row. The diff value for the first row within the same group is set to 0. If group is not given, the whole table is deemed as one single group.