Series.cumSum
Return a cumulative sum of a series
danfo.Series.cumSum(options)
Parameters
Type
Description
Default
options
Object
inplace: Whether to perform the operation in-place or not.
{
inplace: false
}
Example
const dfd = require("danfojs-node")
let data1 = [10, 45, 56, 25, 23, 20, 10]
let sf1 = new dfd.Series(data1)
sf1.cumSum().print()
╔═══╤═════╗
║ 0 │ 10 ║
╟───┼─────╢
║ 1 │ 55 ║
╟───┼─────╢
║ 2 │ 111 ║
╟───┼─────╢
║ 3 │ 136 ║
╟───┼─────╢
║ 4 │ 159 ║
╟───┼─────╢
║ 5 │ 179 ║
╟───┼─────╢
║ 6 │ 189 ║
╚═══╧═════╝
Last updated
Was this helpful?