Skip to content

BUG: DTI-datetime_scalar preserve freq #48818

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

Merged
merged 3 commits into from
Sep 28, 2022

Conversation

jbrockmendel
Copy link
Member

  • closes #xxxx (Replace xxxx with the Github issue number)
  • Tests added and passed if fixing a bug or adding a new feature
  • All code checks passed.
  • Added type annotations to new arguments/methods/functions.
  • Added an entry in the latest doc/source/whatsnew/vX.X.X.rst file if fixing a bug or adding a new feature.

@@ -17,6 +17,15 @@


class TestDatetimeIndex:
def test_sub_datetime_preserves_reso(self, tz_naive_fixture):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add a test where this goes over a DST transition?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch. when we cross a DST transition, dti.freq is actually wrong bc of the (deprecated) kludge in generate_range. As a result, inheriting the freq is incorrect in this case. But it will return to being correct once the deprecation is enforced.

i think the thing to do is add the test and xfail it

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

test added (and xfailed) + green

@mroeschke mroeschke added Numeric Operations Arithmetic, Comparison, and Logical operations Frequency DateOffsets labels Sep 28, 2022
@mroeschke mroeschke added this to the 1.6 milestone Sep 28, 2022
@mroeschke mroeschke merged commit 979c1c6 into pandas-dev:main Sep 28, 2022
@mroeschke
Copy link
Member

Thanks @jbrockmendel

@jbrockmendel jbrockmendel deleted the bug-preserve-reso branch September 28, 2022 23:24
@mroeschke mroeschke modified the milestones: 1.6, 2.0 Oct 13, 2022
noatamir pushed a commit to noatamir/pandas that referenced this pull request Nov 9, 2022
* BUG: DTI-datetime_scalar preserve freq

* GH ref

* add xfail test across DST boundary
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Frequency DateOffsets Numeric Operations Arithmetic, Comparison, and Logical operations
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants