From 6b5e2bfbaefad1084aab7af248f7200033ff6010 Mon Sep 17 00:00:00 2001 From: raisadz <34237447+raisadz@users.noreply.github.com> Date: Fri, 1 Nov 2024 08:22:54 +0000 Subject: [PATCH 1/2] Enh: adding automated inferencing of format `%Y-%m-%dT%H:%M` in pyarrow (#1292) * add pyarrow time parsing with %H:%M format * add test for format %H:%M * add time format mapping * add start and end characters matching Co-authored-by: Francesco Bruzzesi <42817048+FBruzzesi@users.noreply.github.com> --------- Co-authored-by: Francesco Bruzzesi <42817048+FBruzzesi@users.noreply.github.com> --- narwhals/_arrow/utils.py | 15 ++++-- tests/expr_and_series/str/to_datetime_test.py | 52 ++++++++++++++++--- 2 files changed, 56 insertions(+), 11 deletions(-) diff --git a/narwhals/_arrow/utils.py b/narwhals/_arrow/utils.py index bc8d17010..6f74294d5 100644 --- a/narwhals/_arrow/utils.py +++ b/narwhals/_arrow/utils.py @@ -340,7 +340,9 @@ def convert_str_slice_to_int_slice( # Regex for date, time, separator and timezone components DATE_RE = r"(?P\d{1,4}[-/.]\d{1,2}[-/.]\d{1,4})" SEP_RE = r"(?P\s|T)" -TIME_RE = r"(?P