dfr with-column
for dataframe or lazyframe> dfr with-column {flags} ...rest
--name, -n {string}
: new column name...rest
: series to be added or expressions used to define the new columnsinput | output |
---|---|
any | any |
Adds a series to the dataframe
> [[ab]; [12] [34]]
|dfr into-df
|dfr with-column ([56] |dfr into-df) --namec
╭───┬───┬───┬───╮
│# │ a │ b │ c │
├───┼───┼───┼───┤
│0│1│2│5│
│1│3│4│6│
╰───┴───┴───┴───╯
Adds a series to the dataframe
> [[ab]; [12] [34]]
|dfr into-lazy
|dfr with-column [
((dfr cola) *2|dfr as"c")
((dfr cola) *3|dfr as"d")
]
|dfr collect
╭───┬───┬───┬───┬───╮
│# │ a │ b │ c │ d │
├───┼───┼───┼───┼───┤
│0│1│2│2│3│
│1│3│4│6│9│
╰───┴───┴───┴───┴───╯
Tips: Dataframe commands were not shipped in the official binaries by default, you have to build it with --features=dataframe
flag
Copyright © 2019–2023 The Nushell Project DevelopersLicensed under the MIT License.
https://www.nushell.sh/commands/docs/dfr_with-column.html