polars.Expr.dt.minute#

Expr.dt.minute() Expr[source]#

Extract minutes from underlying DateTime representation.

Applies to Datetime columns.

Returns the minute number from 0 to 59.

Returns:
Expr

Expression of data type UInt32.

Examples

>>> from datetime import timedelta, datetime
>>> start = datetime(2001, 1, 1)
>>> stop = datetime(2001, 1, 1, 0, 4, 0)
>>> df = pl.DataFrame(
...     {"date": pl.date_range(start, stop, timedelta(minutes=2), eager=True)}
... )
>>> df
shape: (3, 1)
┌─────────────────────┐
│ date                │
│ ---                 │
│ datetime[μs]        │
╞═════════════════════╡
│ 2001-01-01 00:00:00 │
│ 2001-01-01 00:02:00 │
│ 2001-01-01 00:04:00 │
└─────────────────────┘
>>> df.select(pl.col("date").dt.minute())
shape: (3, 1)
┌──────┐
│ date │
│ ---  │
│ u32  │
╞══════╡
│ 0    │
│ 2    │
│ 4    │
└──────┘