Powered By GitBook
Series.cumsum
Return a cumulative sum of a series
danfo.Series.cumsum(options) [source]
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 ║
3
╟───┼──────────────────────╢
4
║ 0 │ 10 ║
5
╟───┼──────────────────────╢
6
║ 1 │ 55 ║
7
╟───┼──────────────────────╢
8
║ 2 │ 111 ║
9
╟───┼──────────────────────╢
10
║ 3 │ 136 ║
11
╟───┼──────────────────────╢
12
║ 4 │ 159 ║
13
╟───┼──────────────────────╢
14
║ 5 │ 179 ║
15
╟───┼──────────────────────╢
16
║ 6 │ 189 ║
17
╚═══╧══════════════════════╝
Copied!
Last modified 13d ago
Copy link