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
Node
Browser
1
const dfd = require("danfojs-node")
2
3
4
let data1 = [10, 45, 56, 25, 23, 20, 10]
5
let sf1 = new dfd.Series(data1)
6
7
sf1.cumSum().print()
Copied!
1
<!DOCTYPE html>
2
<html lang="en">
3
4
<head>
5
<meta charset="UTF-8">
6
<meta name="viewport" content="width=device-width, initial-scale=1.0">
7
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/index.min.js"></script>
8
<title>Document</title>
9
</head>
10
11
<body>
12
13
<script>
14
15
//danfo is exposed on dfd namespace
16
s = new dfd.Series([1,2,3,4,5])
17
18
</script>
19
20
</body>
21
22
</html>
Copied!
1
╔═══╤═════╗
2
║ 0 │ 10 ║
3
╟───┼─────╢
4
║ 1 │ 55 ║
5
╟───┼─────╢
6
║ 2 │ 111 ║
7
╟───┼─────╢
8
║ 3 │ 136 ║
9
╟───┼─────╢
10
║ 4 │ 159 ║
11
╟───┼─────╢
12
║ 5 │ 179 ║
13
╟───┼─────╢
14
║ 6 │ 189 ║
15
╚═══╧═════╝
Copied!
Last modified 13d ago
Copy link