polars selector by-dtype
For expression.
Creates a selector that selects columns by data type.
warning This command requires a plugin The
polars selector by-dtypecommand resides in thepolarsplugin. To use this command, you must install and registernu_plugin_polars. See the Plugins chapter in the book for more information.
Command Type
plugin
Signature
> polars selector by-dtype {flags} ...rest
Parameters
...rest: Data types to select (e.g., i64, f64, str, bool).
Input/output types:
| input | output |
|---|---|
| any | polars_selector |
Examples
Create a selector for numeric columns
> polars selector by-dtype i64 f64
Double all integer columns using with-column
> [[a b c]; [1 2 "x"] [3 4 "y"]]
| polars into-df
| polars with-column ((polars selector by-dtype i64) * 2)
| polars collect
╭───┬───┬───┬───╮
│ # │ a │ b │ c │
├───┼───┼───┼───┤
│ 0 │ 2 │ 4 │ x │
│ 1 │ 6 │ 8 │ y │
╰───┴───┴───┴───╯
Ported from nushell/nushell.github.io. Copyright (c) 2021 Nushell Project. MIT License.