Convert string dates into a yyyy-mm-dd format. The function uses pl.coalesce to try to process different formats. For example, it will first try to convert m/d/y, and then if that doesn’t work it will try d/m/y.
Note: it won’t attempt to convert excel dates.
Usage
To be applied to a string date column.
Parameters
col:str
a string column that has a date
Returns
output_date:date
a date column
Examples
import polars as plfrom wadoh_raccoon.utils import helpersdf = pl.DataFrame({"dates": ["2024-10-30", # ISO format"30/10/2024", # European format"10/20/2024", # US format"10-30-2024", # US format"October 30, 2024", # Full month name format,"45496", # an excel date LOL"2022-12-27 08:26:49" ]})helpers.gt_style( df .with_columns( new_date=helpers.date_format('dates') ))