daft.Expression.dt.minute

daft.Expression.dt.minute#

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

Retrieves the minute for a datetime column

Example

>>> import daft, datetime
>>> df = daft.from_pydict(
...     {
...         "x": [
...             datetime.datetime(2021, 1, 1, 5, 1, 1),
...             datetime.datetime(2021, 1, 2, 6, 1, 59),
...             datetime.datetime(2021, 1, 3, 7, 2, 0),
...         ],
...     }
... )
>>> df = df.with_column("minute", df["x"].dt.minute())
>>> df.show()
╭───────────────────────────────┬────────╮
│ x                             ┆ minute │
│ ---                           ┆ ---    │
│ Timestamp(Microseconds, None) ┆ UInt32 │
╞═══════════════════════════════╪════════╡
│ 2021-01-01 05:01:01           ┆ 1      │
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌┤
│ 2021-01-02 06:01:59           ┆ 1      │
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌┤
│ 2021-01-03 07:02:00           ┆ 2      │
╰───────────────────────────────┴────────╯

(Showing first 3 of 3 rows)
Returns:

a UInt32 expression with just the minute extracted from a datetime column

Return type:

Expression