polars set
for dataframe
Sets value where given mask is true.
This command requires a plugin
The polars set
command resides in the polars
plugin. To use this command, you must install and register nu_plugin_polars
. See the Plugins chapter in the book for more information.
Signature
> polars set {flags} (value)
Flags
--mask, -m {any}
: mask indicating insertions
Parameters
value
: value to be inserted in series
Input/output types:
input | output |
---|---|
any | any |
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 │
╰───┴───╯