Series.cumsum

Return a cumulative sum of a series

danfo.Series.cumsum() [source]

Parameters: None

Return: Series

Example

Node
Browser
Node
const dfd = require("danfojs-node")
let data1 = [10, 45, 56, 25, 23, 20, 10]
let sf1 = new dfd.Series(data1)
sf1.cumsum().print()
Browser
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://cdn.jsdelivr.net/npm/danfojs@0.0.1.0/dist/index.min.js"></script>
<title>Document</title>
</head>
<body>
<script>
//danfo is exposed on dfd namespace
s = new dfd.Series([1,2,3,4,5])
</script>
</body>
</html>
╔═══╤══════════════════════╗
║ │ 0 ║
╟───┼──────────────────────╢
║ 0 │ 10 ║
╟───┼──────────────────────╢
║ 1 │ 55 ║
╟───┼──────────────────────╢
║ 2 │ 111 ║
╟───┼──────────────────────╢
║ 3 │ 136 ║
╟───┼──────────────────────╢
║ 4 │ 159 ║
╟───┼──────────────────────╢
║ 5 │ 179 ║
╟───┼──────────────────────╢
║ 6 │ 189 ║
╚═══╧══════════════════════╝