WillAyd opened a new issue, #41268:
URL: https://github.com/apache/arrow/issues/41268
### Describe the bug, including details regarding any error messages,
version, and platform.
```python
>>> pa.array(["2024-01-01 05:00:00"]).cast(pa.timestamp("s"))
<pyarrow.lib.TimestampArray object at 0x7c6c794463e0>
[
2024-01-01 05:00:00
]
>>> pa.array([datetime.datetime(2024, 1, 1, 5, 0,
0)]).cast(pa.timestamp("s"))
<pyarrow.lib.TimestampArray object at 0x7c6c79444b80>
[
2024-01-01 05:00:00
]
>>> pa.array([datetime.datetime(2024, 1, 1, 5, 0,
0)]).cast(pa.timestamp("s", "UTC"))
<pyarrow.lib.TimestampArray object at 0x7c6c7956d720>
[
2024-01-01 05:00:00Z
]
>>> pa.array(["2024-01-01 05:00:00"]).cast(pa.timestamp("s", "UTC"))
ArrowInvalid: Failed to parse string: '2024-01-01 05:00:00' as a scalar of
type timestamp[s, tz=UTC]: expected a zone offset. If these timestamps are in
local time, cast to timestamp without timezone, then call assume_timezone.
```
I'm having a hard time figuring out the best way to construct timezone aware
arrays from strings instead of Python datetime objects. Based off the pattern
set by the first 3 examples above it seems like a bug that the fourth does not
work?
### Component(s)
Python
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]