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

unify freq strings (independent of pd version) #8627

Merged
merged 29 commits into from
Feb 15, 2024

Conversation

mathause
Copy link
Collaborator

@mathause mathause commented Jan 19, 2024

  • Adresses points 2 and 3 and closes more frequency string updates? #8612
  • Tests added
  • User visible changes (including notable bug fixes) are documented in whats-new.rst
  • New functions/methods are listed in api.rst

Probably not ready for review yet.

@mathause
Copy link
Collaborator Author

Some more updates. I think this needs more work still. But to make sure I don't forget: I don't update the following line:

loffset = pd.tseries.frequencies.to_offset(loffset)

There is a test with a negative frequency ("-12H") and to_offset cannot handle this (the regex does not allow for it.)

Should to_offset be able to handle negative offsets?

@spencerkclark
Copy link
Member

Thanks @mathause — it does seem reasonable to update our to_offset regex to allow for the minus sign, if it is not too much trouble (the pandas version allows it).

@mathause mathause mentioned this pull request Jan 24, 2024
3 tasks
@mathause mathause marked this pull request as ready for review February 12, 2024 13:28
@mathause
Copy link
Collaborator Author

I am marking this ready to review.

Copy link
Member

@spencerkclark spencerkclark left a comment

Choose a reason for hiding this comment

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

Thanks @mathause—I think this looks good. Awesome that this enables us to silence all the frequency-string-related deprecation warnings in the test suite too!

I'm approving, but could you just add an additional test for both _legacy_to_new_freq and _new_to_legacy_freq that a pandas-only offset string gets passed through unmodified without raising an error?

@mathause mathause enabled auto-merge (squash) February 15, 2024 16:31
@mathause mathause merged commit a91d268 into pydata:main Feb 15, 2024
28 checks passed
@mathause mathause deleted the unify_freq_strings branch February 15, 2024 17:01
@max-sixty
Copy link
Collaborator

Thanks a lot @mathause !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

more frequency string updates?
3 participants