Skip to content

Conversation

Aniketsy
Copy link
Contributor

@Aniketsy Aniketsy commented Sep 6, 2025

#62259.

This PR improves the error message shown when a user specifies a previously-deprecated frequency alias (such as "H", "T", or "S") .

Now, if a deprecated alias is used, the error message clearly states that the alias was removed and suggests the correct replacement (e.g., "Invalid frequency 'H'. This alias was deprecated and removed. Did you mean 'h'?").

Please let me know if my approach or fix needs any improvements . I’m open to feedback and happy to make changes based on suggestions.
Thankyou !

@Aniketsy
Copy link
Contributor Author

Aniketsy commented Sep 7, 2025

@jorisvandenbossche Could you please review it when you get time?
Thanks!

@simonjayhawkins simonjayhawkins added Error Reporting Incorrect or improved errors from pandas Frequency DateOffsets labels Sep 10, 2025
@Aniketsy
Copy link
Contributor Author

Aniketsy commented Oct 1, 2025

Hi, @jbrockmendel
To ensure the improved error message for deprecated frequency aliases is applied consistently, all code paths should use the to_offset wrapper from pandas.tseries.frequencies. This requires updating imports of to_offset across the codebase.

from pandas._libs.tslibs.offsets import to_offset
to:
from pandas.tseries.frequencies import to_offset

Is this correct, or would you recommend a different solution?
Thank you!

@jbrockmendel
Copy link
Member

This requires updating imports of to_offset across the codebase.

Why? they're the same function. There is no wrapper.

@Aniketsy
Copy link
Contributor Author

Aniketsy commented Oct 2, 2025

I may have misunderstood earlier, my intention was to ensure that the improved error message for deprecated frequency aliases is displayed consistently. I thought that adding a to_offset wrapper in pandas.tseries.frequencies would help achieve this.

@mroeschke
Copy link
Member

Thanks for the PR, but the linked issue appears to have been addressed so closing

@mroeschke mroeschke closed this Oct 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Error Reporting Incorrect or improved errors from pandas Frequency DateOffsets

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants