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:
| input | output |
|---|---|
| polars_dataframe | polars_dataframe |
| polars_lazyframe | polars_lazyframe |
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 │
╰───┴───╯
Copyright © 2019–2026 The Nushell Project DevelopersLicensed under the MIT License.
https://www.nushell.sh/commands/docs/polars_set.html