polars selector by-dtype for expression
Creates a selector that selects columns by data type.
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 f64Double 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 │
╰───┴───┴───┴───╯