Expr.str.to_time
methodView source ↗
def to_time(fmt: str | None = None, strict: bool = True, cache: bool = True) -> Expr
Categories: type_casting
Convert the string to a time.
Parameters
parameter
fmtThe time format string (default %H:%M:%S). See formats <https://docs.rs/chrono/0.4.19/chrono/format/strftime/index.html>_.
parameter
strictWhether to parse the date strictly.
parameter
cacheWhether to cache the date.
Examples
>>> import tabsdata as td
>>>
>>> tf: td.TableFrame ...
>>>
>>> tf.select(td.col("a"), td.col("a").str.to_time().alias("to_time"))
>>>
┌─────────────────────┬─────────────────────┐
│ a ┆ to_datetime │
│ --- ┆ --- │
│ str ┆ datetime[μs] │
╞═════════════════════╪═════════════════════╡
│ 2024-12-13 08:45:34 ┆ 2024-12-13 08:45:34 │
│ 2024-12-15 18:33:00 ┆ 2024-12-15 18:33:00 │
│ null ┆ null │
└─────────────────────┴─────────────────────┘