rok commented on pull request #11818:
URL: https://github.com/apache/arrow/pull/11818#issuecomment-999499229
> > I've decided to remove `Nonexistent` and `Ambiguous`.
>
> (didn't yet look at the code) Did you then also remove support rounding
timestamps with a timezone? Or how does rounding tz-aware timestamps work?
At the moment some of the code (ns, us, ms, s, m, h, d, w) is UTC based even
when timezones are present. UTC always converts to a local time so nonexistent
is not an issue while ambiguous could be.
Month, quarter, year are currently rounded in local time and integer
multiples of those "units" are less problematic because beginnings of months
seem to always exist. Perhaps this needs more study.
> It's also not really clear to me what `origin` would do. Can you explain
with an example what it would do? (I also don't see it in lubridate or pandas?)
Origin is meant like the origin in Euclidean space. Let's say you want to
floor today's date to `100year`:
```python
floor("2021-12-22", unit="year", multiple=100, origin="1970-01-01") ==
"1970-01-01"
floor("2021-12-22", unit="year", multiple=100, origin="0-01-01") ==
"2000-01-01"
```
R's
[clock](https://clock.r-lib.org/reference/date-and-date-time-rounding.html) has
this concept.
It's also a "replacement" for `week_starts_monday`.
e.g.: `1970-01-01` was a Thursday so `floor(t, unit="week", multiple=1,
origin="1970-01-05")` is equivalent to `floor(t, unit="week", multiple=1,
week_starts_monday=True)`
--
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]