polars.internals.expr.datetime.ExprDateTimeNameSpace.minutes#

ExprDateTimeNameSpace.minutes() Expr[source]#

Extract the minutes from a Duration type.

Returns:
A series of dtype Int64

Examples

>>> from datetime import datetime
>>> df = pl.DataFrame(
...     {
...         "date": pl.date_range(
...             datetime(2020, 1, 1), datetime(2020, 1, 4), "1d"
...         ),
...     }
... )
>>> df.select(
...     [
...         pl.col("date"),
...         pl.col("date").diff().dt.minutes().alias("minutes_diff"),
...     ]
... )
shape: (4, 2)
┌─────────────────────┬──────────────┐
│ date                ┆ minutes_diff │
│ ---                 ┆ ---          │
│ datetime[μs]        ┆ i64          │
╞═════════════════════╪══════════════╡
│ 2020-01-01 00:00:00 ┆ null         │
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
│ 2020-01-02 00:00:00 ┆ 1440         │
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
│ 2020-01-03 00:00:00 ┆ 1440         │
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
│ 2020-01-04 00:00:00 ┆ 1440         │
└─────────────────────┴──────────────┘