daft.Expression.dt.day#
- Expression.dt.day() Expression [source]#
Retrieves the day 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("day", df["x"].dt.day()) >>> df.show() ╭───────────────────────────────┬────────╮ │ x ┆ day │ │ --- ┆ --- │ │ Timestamp(Microseconds, None) ┆ UInt32 │ ╞═══════════════════════════════╪════════╡ │ 2021-01-01 05:01:01 ┆ 1 │ ├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌┤ │ 2021-01-02 06:01:59 ┆ 2 │ ├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌┤ │ 2021-01-03 07:02:00 ┆ 3 │ ╰───────────────────────────────┴────────╯ (Showing first 3 of 3 rows)
- Returns:
a UInt32 expression with just the day extracted from a datetime column
- Return type:
Expression