Select all decimal columns
Description
Select all decimal columns
Usage
cs__decimal()
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(123, 456),
baz = c("2.0005", "-50.5555"),
.schema_overrides = list(
bar = pl$Decimal(),
baz = pl$Decimal(scale = 5, precision = 10)
)
)
# Select decimal columns:
df$select(cs$decimal())
#> shape: (2, 2)
#> ┌──────────────┬───────────────┐
#> │ bar ┆ baz │
#> │ --- ┆ --- │
#> │ decimal[*,0] ┆ decimal[10,5] │
#> ╞══════════════╪═══════════════╡
#> │ 123 ┆ 2.00050 │
#> │ 456 ┆ -50.55550 │
#> └──────────────┴───────────────┘
#> shape: (2, 1)
#> ┌─────┐
#> │ foo │
#> │ --- │
#> │ str │
#> ╞═════╡
#> │ x │
#> │ y │
#> └─────┘