Skip to content

Minutes

Source code

Description

Extract the minutes from a Duration type.

Usage

<Expr>$dt$total_minutes()

Value

Expr of i64

Examples

library(polars)

df = pl$DataFrame(
  date = pl$date_range(
    start = as.Date("2020-1-1"),
    end = as.Date("2020-1-4"),
    interval = "1d"
  )
)
df$select(
  pl$col("date"),
  diff_minutes = pl$col("date")$diff()$dt$total_minutes()
)
#> shape: (4, 2)
#> ┌────────────┬──────────────┐
#> │ date       ┆ diff_minutes │
#> │ ---        ┆ ---          │
#> │ date       ┆ i64          │
#> ╞════════════╪══════════════╡
#> │ 2020-01-01 ┆ null         │
#> │ 2020-01-02 ┆ 1440         │
#> │ 2020-01-03 ┆ 1440         │
#> │ 2020-01-04 ┆ 1440         │
#> └────────────┴──────────────┘