jorisvandenbossche commented on PR #12528:
URL: https://github.com/apache/arrow/pull/12528#issuecomment-1131369183
Lubridate:
```
> x <- ymd_hms(c("2015-03-29 01:50:00", "2015-03-29 01:59:59", "2015-03-29
03:00:00", "2015-03-29 03:10:00"), tz = "Europe/Brussels")
> x
[1] "2015-03-29 01:50:00 CET" "2015-03-29 01:59:59 CET"
[3] "2015-03-29 03:00:00 CEST" "2015-03-29 03:10:00 CEST"
> round_date(x, "16 mins")
[1] "2015-03-29 01:48:00 CET" "2015-03-29 03:04:00 CEST"
[3] "2015-03-29 03:00:00 CEST" "2015-03-29 03:16:00 CEST"
```
(I haven't yet tried to understand the logic behind those results, but so
none of the 4 values match with any of the values that this PR currently
returns ...)
In pandas:
```
x = pd.Series(pd.to_datetime(["2015-03-29 01:50:00", "2015-03-29 01:59:59",
"2015-03-29 03:00:00", "2015-03-29 03:10:00"]).tz_localize("Europe/Brussels"))
In [9]: x
Out[9]:
0 2015-03-29 01:50:00+01:00
1 2015-03-29 01:59:59+01:00
2 2015-03-29 03:00:00+02:00
3 2015-03-29 03:10:00+02:00
dtype: datetime64[ns, Europe/Brussels]
In [12]: x.dt.round("16min", nonexistent="NaT")
Out[12]:
0 2015-03-29 01:52:00+01:00
1 2015-03-29 01:52:00+01:00
2 NaT
3 2015-03-29 03:12:00+02:00
dtype: datetime64[ns, Europe/Brussels]
```
--
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]