You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "AlenkaF (via GitHub)" <gi...@apache.org> on 2024/01/29 13:19:15 UTC
Re: [I] [Python] UTC Timezone Equality is case sensitive [arrow]
AlenkaF commented on issue #39809:
URL: https://github.com/apache/arrow/issues/39809#issuecomment-1914681651
The comparison of DataTypes is done in Arrow C++ and for timestamps it is comparing the exact timezone string (it is saved as a string) as you have mentioned.
To do a logical comparison of timezones one should probably use a dedicated library for that. In Python you could try with:
```python
>>> import pytz
>>> pytz.timezone(pa.timestamp("us", "UTC").tz)
<UTC>
>>> pytz.timezone(pa.timestamp("us", "utc").tz)
<UTC>
>>> pytz.timezone(pa.timestamp("us", "utc").tz) == pytz.timezone(pa.timestamp("us", "UTC").tz)
```
and then separately compare the timestamp unit:
```python
>>> pa.timestamp("us", "utc").unit == pa.timestamp("us", "UTC").unit
True
```
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org