Select all temporal columns
Description
Select all temporal columns
Usage
cs__temporal()
Value
A Polars selector
See Also
cs for the documentation on operators supported by Polars selectors.
Examples
library("polars")
df <- pl$DataFrame(
dtm = as.POSIXct(c("2001-5-7 10:25", "2031-12-31 00:30")),
dt = as.Date(c("1999-12-31", "2024-8-9")),
value = 1:2
)
# Match all temporal columns:
df$select(cs$temporal())
#> shape: (2, 2)
#> ┌─────────────────────┬────────────┐
#> │ dtm ┆ dt │
#> │ --- ┆ --- │
#> │ datetime[ms] ┆ date │
#> ╞═════════════════════╪════════════╡
#> │ 2001-05-07 10:25:00 ┆ 1999-12-31 │
#> │ 2031-12-31 00:30:00 ┆ 2024-08-09 │
#> └─────────────────────┴────────────┘
#> shape: (2, 1)
#> ┌────────────┐
#> │ dt │
#> │ --- │
#> │ date │
#> ╞════════════╡
#> │ 1999-12-31 │
#> │ 2024-08-09 │
#> └────────────┘
#> shape: (2, 1)
#> ┌───────┐
#> │ value │
#> │ --- │
#> │ i32 │
#> ╞═══════╡
#> │ 1 │
#> │ 2 │
#> └───────┘