You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "jorisvandenbossche (via GitHub)" <gi...@apache.org> on 2023/06/15 18:36:36 UTC

[GitHub] [arrow] jorisvandenbossche commented on issue #15047: [Python] Drop pytz for timezone support (default to use datetime.timezone / zoneinfo)

jorisvandenbossche commented on issue #15047:
URL: https://github.com/apache/arrow/issues/15047#issuecomment-1593550760

   The fallback mentioned above is about the conversion pyarrow -> python/pandas. In the past, we required pytz for this, but now in an environment where pytz is not installed, you can see we use zoneinfo. Using your example `ts`:
   
   ```
   >>> ts
   <pyarrow.lib.TimestampArray object at 0x7f8c9f762ec0>
   [
     2038-04-01 10:00:00.000000
   ]
   >>> ts[0].as_py()
   datetime.datetime(2038, 4, 1, 4, 0, tzinfo=zoneinfo.ZoneInfo(key='America/Boise'))
   ```
   
   which uses a ZoneInfo. While if I then install pytz in that environment, the result I get is:
   
   ```
   >>> ts[0].as_py()
   datetime.datetime(2038, 4, 1, 3, 0, tzinfo=<DstTzInfo 'America/Boise' MST-1 day, 17:00:00 STD>)
   >>> type(ts[0].as_py().tzinfo)
   <class 'pytz.tzfile.America/Boise'>
   ```
   
   Now, the conversion from python -> pyarrow should already support zoneinfo, regardless of pytz being available (the function that handles the timezone has several cases depending on the exact tz object). But it might be there is a bug in there (certainly something to investigate, clearly!), but so that's a separate issue. Can you open a new issue for that?
   


-- 
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