jorisvandenbossche commented on code in PR #49694:
URL: https://github.com/apache/arrow/pull/49694#discussion_r3065469520
##########
python/pyarrow/scalar.pxi:
##########
@@ -822,7 +822,14 @@ cdef class TimestampScalar(Scalar):
return None
if not dtype.timezone().empty():
- tzinfo = string_to_tzinfo(frombytes(dtype.timezone()))
+ prefer_zoneinfo = True
+ # only we this method would return a pandas.Timestamp, prefer
+ # zoneinfo depending on the pandas version
+ if _pandas_api.have_pandas and dtype.unit() == TimeUnit_NANO:
+ prefer_zoneinfo = _pandas_api.is_ge_v3()
Review Comment:
```suggestion
# for datetime.datetime output, always prefer zoneinfo over pytz
prefer_zoneinfo = True
if _pandas_api.have_pandas and dtype.unit() == TimeUnit_NANO:
# but if this method returns a pandas.Timestamp (i.e. pandas
installed
# and nano unit) -> adjust preference based on the pandas
version
# (i.e. keep returning pytz for older pandas)
prefer_zoneinfo = _pandas_api.is_ge_v3()
```
@AlenkaF would this be clearer?
--
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]