Select all float columns.
Description
Select all float columns.
Usage
cs__float()
Value
A Polars selector
See Also
cs for the documentation on operators supported by Polars selectors.
Examples
library("polars")
df <- pl$DataFrame(
foo = c("x", "y"),
bar = c(123L, 456L),
baz = c(2.0, 5.5),
zap = c(FALSE, TRUE),
.schema_overrides = list(baz = pl$Float32, zap = pl$Float64),
)
# Select all float columns:
df$select(cs$float())
#> shape: (2, 2)
#> ┌─────┬─────┐
#> │ baz ┆ zap │
#> │ --- ┆ --- │
#> │ f32 ┆ f64 │
#> ╞═════╪═════╡
#> │ 2.0 ┆ 0.0 │
#> │ 5.5 ┆ 1.0 │
#> └─────┴─────┘
#> shape: (2, 2)
#> ┌─────┬─────┐
#> │ foo ┆ bar │
#> │ --- ┆ --- │
#> │ str ┆ i32 │
#> ╞═════╪═════╡
#> │ x ┆ 123 │
#> │ y ┆ 456 │
#> └─────┴─────┘