llms.txt: machine-readable documentation index. Markdown version of this page is also available.

DataFrame Help

cumSum

Computes the cumulative sum of values in the selected columns.

API reference: cumSum

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 the 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 }
02 November 2026