polars set for dataframe

Sets value where given mask is true.

Signature

> polars set {flags} (value)

Flags

  • --mask, -m {any}: mask indicating insertions

Parameters

  • value: value to be inserted in series

Input/output types:

inputoutput
anyany

Examples

Shifts the values by a given period

> let s = ([1 2 2 3 3] | polars into-df | polars shift 2);
    let mask = ($s | polars is-null);
    $s | polars set 0 --mask $mask
╭───┬───╮
 # │ 0 │
├───┼───┤
 0 0
 1 0
 2 1
 3 2
 4 2
╰───┴───╯