Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DOC: Clarify DST rounding behavior in Timestamp/DatetimeIndex #44357

Merged

Conversation

mroeschke
Copy link
Member

xref #44287

  • Ensure all linting tests pass, see here for how to run them

@mroeschke mroeschke added Docs Datetime Datetime data dtype labels Nov 8, 2021
@mroeschke mroeschke added this to the 1.4 milestone Nov 12, 2021
@jreback
Copy link
Contributor

jreback commented Nov 13, 2021

just wondering out loud if we could/should actually do this in a tz-aware way for .round, .ceil, .floor; e.g. are these fundamentally different ops that say subtraction that we could always do this w/o going ambiguous

cc @mroeschke

@mroeschke
Copy link
Member Author

@jreback found discussion #22560 (comment) and #22560 (comment) that rounding in a tz-aware might not actually be possible and falling back to rounding based on actual, UTC time may give unexpected results.

@jreback
Copy link
Contributor

jreback commented Nov 14, 2021

my question is can we leave in thr tz and do a round operation w/o introducing ambiguity?

@mroeschke
Copy link
Member Author

Hmm since the rounding operations happen on epoch timestamps, rounding could happen on the UTC epoch timestamps and relocalized without ambiguity i.e. .tz_convert("UTC").round(...).tz_convert(tz). But this flies counter to #22560 (comment) and the notion of "round relative to the wall time"

@jreback
Copy link
Contributor

jreback commented Nov 14, 2021

@mroeschke rereading i am wondering if it's always possible in freq < day (eg hour / min) to do the round ops in local time (and not convert-round-localize) which can introduce ambiguity

@mroeschke
Copy link
Member Author

Yeah for small rounding frequencies this can be achieved. Looking at the UTC offsets I think the limit is sub 15 minutes (I see a +05:45 UTC offset for example)

@jreback jreback merged commit 0e8ff31 into pandas-dev:master Nov 17, 2021
@jreback
Copy link
Contributor

jreback commented Nov 17, 2021

thanks @mroeschke

@mroeschke mroeschke deleted the doc/timestamp_datetimeindex_rounding branch November 17, 2021 17:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Datetime Datetime data dtype Docs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants