DataFrame.cumMin

Return cumulative minimum over a DataFrame or Series axis.

danfo.DataFrame.cumMin(options)

ParametersTypeDescriptionDefault

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}

Examples

Cumulative minimum of elements along axis 0 (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.cumMin({ axis: 0 })

new_df.print()
╔═══╤═══════════════════╤═══════════════════╤═══════════════════╗
║   │ A                 │ B                 │ C                 ║
╟───┼───────────────────┼───────────────────┼───────────────────╢
║ 0 │ 11                │ 20                │ 3                 ║
╟───┼───────────────────┼───────────────────┼───────────────────╢
║ 1 │ 1                 │ 15                │ 3                 ║
╟───┼───────────────────┼───────────────────┼───────────────────╢
║ 2 │ 1                 │ 15                │ 3                 ║
╟───┼───────────────────┼───────────────────┼───────────────────╢
║ 3 │ 1                 │ 15                │ 3                 ║
╚═══╧═══════════════════╧═══════════════════╧═══════════════════╝

Cumulative minimum 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.cumMin({ axis: 1 })

new_df.print()
╔═══╤═══════════════════╤═══════════════════╤═══════════════════╗
║   │ A                 │ B                 │ C                 ║
╟───┼───────────────────┼───────────────────┼───────────────────╢
║ 0 │ 11                │ 11                │ 3                 ║
╟───┼───────────────────┼───────────────────┼───────────────────╢
║ 1 │ 1                 │ 1                 │ 1                 ║
╟───┼───────────────────┼───────────────────┼───────────────────╢
║ 2 │ 2                 │ 2                 │ 2                 ║
╟───┼───────────────────┼───────────────────┼───────────────────╢
║ 3 │ 2                 │ 2                 │ 2                 ║
╚═══╧═══════════════════╧═══════════════════╧═══════════════════╝

Last updated