Skip to content

Data type representing a time duration

Source code

Description

Data type representing a time duration

Usage

DataType_Duration(time_unit = "us")

Arguments

time_unit Unit of time. One of “ms”, “us” (default) or “ns”.

Value

Duration DataType

Examples

library("polars")

test = pl$DataFrame(
  a = 1:2,
  b = c("a", "b"),
  c = pl$duration(weeks = c(1, 2), days = c(0, 2))
)

# select all columns of type "duration"
test$select(pl$col(pl$Duration()))
#> shape: (2, 1)
#> ┌──────────────┐
#> │ c            │
#> │ ---          │
#> │ duration[μs] │
#> ╞══════════════╡
#> │ 7d           │
#> │ 16d          │
#> └──────────────┘