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 2023/01/24 08:36:26 UTC

[GitHub] [arrow] AlenkaF commented on issue #33842: [Python] ENH: Preserve tzinfo from datetime.time objects when contructing pa.array

AlenkaF commented on issue #33842:
URL: https://github.com/apache/arrow/issues/33842#issuecomment-1401553189

   The builtin `datetime.time` is converted to `time64` in Arrow (see https://arrow.apache.org/docs/python/pandas.html#time-types) and [pa.time64()](https://arrow.apache.org/docs/python/generated/pyarrow.time64.html) is not, as far as I understand, timezone aware.
   
   The information about the timezone is stored in [pa.timestamp()](https://arrow.apache.org/docs/python/generated/pyarrow.timestamp.html) data type which works correctly:
   
   ```python
   >>> dt = datetime.datetime(2023, 1, 24, 0, 12, 0, tzinfo=datetime.timezone.utc)
   >>> pa.array([dt]).type
   TimestampType(timestamp[us, tz=UTC])
   >>> pa.array([dt]).to_pylist()
   [datetime.datetime(2023, 1, 24, 0, 12, tzinfo=<UTC>)]
   ```


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