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