-
-
Notifications
You must be signed in to change notification settings - Fork 19.3k
BUG: honor ambiguous/nonexistent for tz-aware endpoints in date_range #62493
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
BUG: honor ambiguous/nonexistent for tz-aware endpoints in date_range #62493
Conversation
| end = Timestamp("1916-12-01", tz="Europe/Oslo") | ||
| res = date_range(start, end, freq="MS", ambiguous=True) | ||
| exp = date_range( | ||
| "1916-08-01", "1916-12-01", freq="MS", tz="Europe/Oslo", ambiguous=True |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add another test that uses nonexistent?
Co-authored-by: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com>
…angel/pandas into fix-date_range-ambiguous
| expected = [ | ||
| Timestamp("2015-03-28 01:30:00+00:00"), | ||
| Timestamp( | ||
| "2015-03-29 02:00:00+01:00" | ||
| ), # shifted forward over next valid wall time | ||
| Timestamp("2015-03-30 01:30:00+01:00"), | ||
| ] | ||
|
|
||
| assert list(result) == expected |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you use tm.assert_index.equal to compare here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated the expected block to ensure dtype and freq match the date_range result.
|
Thanks @floura-angel |
…pandas-dev#62493) Co-authored-by: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com>
…pandas-dev#62493) Co-authored-by: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com>
Added tests in
pandas/tests/indexes/datetimes/test_date_range.py.(Not applicable — no new public API.)
doc/source/whatsnew/vX.X.X.rstfile under Bug fixes → Timezones.