jorisvandenbossche commented on pull request #11818:
URL: https://github.com/apache/arrow/pull/11818#issuecomment-1000238934


   I suppose a simpler example is actually also rounding to a multiple of hours 
in a normal timezone. For example for me, the current UTC offset is +1, so 
rounding to two hours will give a different result when doing it in UTC:
   
   ```python
   >>> ts = pd.Timestamp("2021-12-23 12:17:00", tz="Europe/Brussels")
   >>> ts
   Timestamp('2021-12-23 12:17:00+0100', tz='Europe/Brussels')
   # with pandas I get 12:00
   >>> ts.round("2H")
   Timestamp('2021-12-23 12:00:00+0100', tz='Europe/Brussels')
   
   >>> arr = pa.array([ts])
   >>> pc.round_temporal(arr, unit="hour", multiple=2)
   <pyarrow.lib.TimestampArray object at 0x7f743c74cc40>
   [
     2021-12-23 12:00:00.000000
   ]
   # but with arrow I get 12:00 in UTC, so 13:00 in local time
   >>> pc.round_temporal(arr, unit="hour", multiple=2)[0]
   <pyarrow.TimestampScalar: datetime.datetime(2021, 12, 23, 13, 0, 
tzinfo=<DstTzInfo 'Europe/Brussels' CET+1:00:00 STD>)>
   ```


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


Reply via email to