daft.Expression.dt.second#
- Expression.dt.second() Expression [source]#
Retrieves the second for a datetime column
Example
>>> import daft, datetime >>> df = daft.from_pydict( ... { ... "x": [ ... datetime.datetime(2021, 1, 1, 0, 1, 1), ... datetime.datetime(2021, 1, 1, 0, 1, 59), ... datetime.datetime(2021, 1, 1, 0, 2, 0), ... ], ... } ... ) >>> df = df.with_column("second", df["x"].dt.second()) >>> df.show() ╭───────────────────────────────┬────────╮ │ x ┆ second │ │ --- ┆ --- │ │ Timestamp(Microseconds, None) ┆ UInt32 │ ╞═══════════════════════════════╪════════╡ │ 2021-01-01 00:01:01 ┆ 1 │ ├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌┤ │ 2021-01-01 00:01:59 ┆ 59 │ ├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌┤ │ 2021-01-01 00:02:00 ┆ 0 │ ╰───────────────────────────────┴────────╯ (Showing first 3 of 3 rows)
- Returns:
a UInt32 expression with just the second extracted from a datetime column
- Return type:
Expression