You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[C++] string created by strftime can't be parsed by strptime #40170
Describe the bug, including details regarding any error messages, version, and platform.
pa.compute.strftime(pd.Timestamp.utcnow(), "%Y-%m-%d %z")
<pyarrow.StringScalar: '2024-02-21 +0000'>
pa.compute.strptime('2024-02-21 +0000', "%Y-%m-%d %z", "ns")
Traceback (most recent call last):
File "", line 1, in
File "D:\pd_dev_1208\Lib\site-packages\pyarrow\compute.py", line 263, in wrapper
return func.call(args, options, memory_pool)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "pyarrow_compute.pyx", line 385, in pyarrow._compute.Function.call
File "pyarrow\error.pxi", line 154, in pyarrow.lib.pyarrow_internal_check_status
File "pyarrow\error.pxi", line 91, in pyarrow.lib.check_status
pyarrow.lib.ArrowInvalid: Failed to parse string: '2024-02-21 +0000' as a scalar of type timestamp[ns]
changed the title [-]string created by strftime can't be parsed by strptime[/-][+][C++] string created by strftime can't be parsed by strptime[/+]on Feb 27, 2024
Thanks for reporting this! I'm going through older bug issues to see if we can close them out or we need further action.
This still reproduces on Windows with pyarrow 26.0.1, and it is not specific to +0000: any format containing %z fails to parse on Windows, while the same calls work on Linux and macOS. On Windows Arrow uses a vendored strptime (cpp/src/arrow/util/value_parsing.h:821), and cpp/src/arrow/vendored/musl/strptime.c has no case for %z, so it returns failure at the default: branch.
Related: #34081 covers %z on macOS, where offsets with a colon fail.
Activity
jorisvandenbossche commentedon Feb 27, 2024
Which version of pyarrow are you using? For me, using the latest dev version, this seems to work fine:
jorisvandenbossche commentedon Feb 27, 2024
Ah, and potentially the platform is more relevant information. I suppose you are using Windows (from the file paths)?
For Windows, we have a vendored implementation for strptime, while for unix we use the system's one, I think
[-]string created by strftime can't be parsed by strptime[/-][+][C++] string created by strftime can't be parsed by strptime[/+]rohanjain101 commentedon Feb 27, 2024
Yes windows with latest pyarrow. I guess it is related to the vendored implementation then.
thisisnic commentedon Nov 23, 2026
Thanks for reporting this! I'm going through older bug issues to see if we can close them out or we need further action.
This still reproduces on Windows with pyarrow 26.0.1, and it is not specific to
+0000: any format containing%zfails to parse on Windows, while the same calls work on Linux and macOS. On Windows Arrow uses a vendoredstrptime(cpp/src/arrow/util/value_parsing.h:821), andcpp/src/arrow/vendored/musl/strptime.chas no case for%z, so it returns failure at thedefault:branch.Related: #34081 covers
%zon macOS, where offsets with a colon fail.