Repository navigation
Open
Labels
Description
Describe the bug, including details regarding any error messages, version, and platform.
Timezone information seems to be supported as per #29023. And it works fine on Linux:
Python 3.8.14 (default, Sep 8 2022, 00:02:07)
Type 'copyright', 'credits' or 'license' for more information
IPython 8.9.0 -- An enhanced Interactive Python. Type '?' for help.
In [1]: import pyarrow
In [2]: import platform
In [3]: platform.platform()
Out[3]: 'Linux-5.15.0-1021-aws-x86_64-with-glibc2.35'
In [4]: pyarrow.__version__
Out[4]: '11.0.0'
In [5]: from pyarrow.compute import strptime
In [6]: strptime(["2012-01-01 01:02:03+01:00"], format="%Y-%m-%d %H:%M:%S%z", un
...: it="s")
Out[6]:
<pyarrow.lib.TimestampArray object at 0x7f80826b6520>
[
2012-01-01 00:02:03
]
However, it raises an error on MacOS:
Python 3.8.15 (default, Oct 21 2022, 23:32:29)
Type 'copyright', 'credits' or 'license' for more information
IPython 8.5.0 -- An enhanced Interactive Python. Type '?' for help.
In [1]: import pyarrow
In [2]: import platform
In [3]: platform.platform()
Out[3]: 'macOS-13.1-arm64-arm-64bit'
In [4]: pyarrow.__version__
Out[4]: '11.0.0'
In [5]: from pyarrow.compute import strptime
In [6]: strptime(["2012-01-01 01:02:03+01:00"], format="%Y-%m-%d %H:%M:%S%z", un
...: it="s")
---------------------------------------------------------------------------
ArrowInvalid Traceback (most recent call last)
Cell In [6], line 1
----> 1 strptime(["2012-01-01 01:02:03+01:00"], format="%Y-%m-%d %H:%M:%S%z", unit="s")
File ~/arrowtest/lib/python3.8/site-packages/pyarrow/compute.py:256, in _make_generic_wrapper.<locals>.wrapper(memory_pool, options, *args, **kwargs)
254 if args and isinstance(args[0], Expression):
255 return Expression._call(func_name, list(args), options)
--> 256 return func.call(args, options, memory_pool)
File ~/arrowtest/lib/python3.8/site-packages/pyarrow/_compute.pyx:355, in pyarrow._compute.Function.call()
File ~/arrowtest/lib/python3.8/site-packages/pyarrow/error.pxi:144, in pyarrow.lib.pyarrow_internal_check_status()
File ~/arrowtest/lib/python3.8/site-packages/pyarrow/error.pxi:100, in pyarrow.lib.check_status()
ArrowInvalid: Failed to parse string: '2012-01-01 01:02:03+01:00' as a scalar of type timestamp[s]
I've looked into the umbrella issue (#31324) but couldn't see this one. Sorry if I missed a duplicate issue.
Component(s)
Python
Activity
westonpace commentedon Feb 9, 2023
CC @rok is this an issue you've encountered before?
rok commentedon Feb 9, 2023
Hey! Strptime uses system
strptimeon linux/MacOS and vendored strptime on windows. As per comment here:I suspect
strptime(["2012-01-01 01:02:03+0100"], format="%Y-%m-%d %H:%M:%S%z", unit="s")will work on MacOS.Thanks for reporting this @ayhanfuat ! Let's include this into the umbrella issue as it would be nice to fix.
[-][Python] strptime fails to parse with %z on Mac[/-][+][C++] strptime fails to parse with %z on MacOS when zone offset includes ":"[/+]ayhanfuat commentedon Feb 9, 2023
It does! Thank you.
rok commentedon Feb 9, 2023
Perfect! Let's leave the issue open so it eventually gets fixed.
thisisnic commentedon Nov 23, 2026
This still reproduces on macOS (arm64 and Intel) with pyarrow 26.0.1:
%zparses+0100but not+01:00orZ, as diagnosed above. Linux parses all three.Related: #40170 covers
%zon Windows, where the vendoredstrptimedoes not support%zat all, so switching macOS to the vendored implementation would not fix this on its own.