DataFrame 1.0 Help

cumSum

Computes the cumulative sum of values in the selected columns.

cumSum(skipNA = true) [ { columns } ]

Returns a DataFrame or DataColumn containing the cumulative sum.

See column selectors for how to select the columns for this operation.

Parameters:

  • skipNA — when true, ignores NA values (null or NaN). When false, all values after first NA will be NaN (for Double and Float columns) or null (for integer columns).

Available for:

df.cumSum { weight } df.weight.cumSum() df.groupBy { city }.cumSum { weight }.concat()

Big numbers

For a BigDecimal column amount, the exact cumulative sum can be computed with Java BigDecimal arithmetic:

// exact cumulative sum, computed with Java `BigDecimal` arithmetic df.amount.toList().runningReduce(BigDecimal::add).toColumn("amount")

Alternatively, convert the column to a primitive type first — at the cost of precision:

// approximate cumulative sum, computed after converting the column to `Double` df.convert { amount }.toDouble().cumSum { amount }
29 September 2026