DataFrame.cumMax
Return cumulative maximum over a DataFrame or Series axis.
danfo.DataFrame.cumMax(options)
Parameters
Type
Description
Default
options
Object
axis: 0 for row and 1 for column
inplace: Boolean indicating whether to perform the operation inplace or not. Defaults to false
{axis: 1, inplace: false}
Returns:
**** return DataFrame
Examples
Cumulative maximum of elements along axis (row)
const dfd = require("danfojs-node")
let data = [[11, 20, 3], [1, 15, 6], [2, 30, 40], [2, 89, 78]]
let cols = ["A", "B", "C"]
let df = new dfd.DataFrame(data, { columns: cols })
let new_df = df.cumMax({ axis: 0 })
new_df.print()╔═══╤═══════════════════╤═══════════════════╤═══════════════════╗
║   │ A                 │ B                 │ C                 ║
╟───┼───────────────────┼───────────────────┼───────────────────╢
║ 0 │ 11                │ 20                │ 3                 ║
╟───┼───────────────────┼───────────────────┼───────────────────╢
║ 1 │ 11                │ 20                │ 6                 ║
╟───┼───────────────────┼───────────────────┼───────────────────╢
║ 2 │ 11                │ 30                │ 40                ║
╟───┼───────────────────┼───────────────────┼───────────────────╢
║ 3 │ 11                │ 89                │ 78                ║
╚═══╧═══════════════════╧═══════════════════╧═══════════════════╝Cumulative maximum of elements along column axis (1)
const dfd = require("danfojs-node")
let data = [[11, 20, 3], [1, 15, 6], [2, 30, 40], [2, 89, 78]]
let cols = ["A", "B", "C"]
let df = new dfd.DataFrame(data, { columns: cols })
let new_df = df.cumMax({ axis: 1 })
new_df.print()╔═══╤═══════════════════╤═══════════════════╤═══════════════════╗
║   │ A                 │ B                 │ C                 ║
╟───┼───────────────────┼───────────────────┼───────────────────╢
║ 0 │ 11                │ 20                │ 20                ║
╟───┼───────────────────┼───────────────────┼───────────────────╢
║ 1 │ 1                 │ 15                │ 15                ║
╟───┼───────────────────┼───────────────────┼───────────────────╢
║ 2 │ 2                 │ 30                │ 40                ║
╟───┼───────────────────┼───────────────────┼───────────────────╢
║ 3 │ 2                 │ 89                │ 89                ║
╚═══╧═══════════════════╧═══════════════════╧═══════════════════╝Last updated
Was this helpful?
