-
-
Notifications
You must be signed in to change notification settings - Fork 18.1k
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
DEPR: deprecate unit parameters ’T’, 't', 'L', and 'l' #53557
DEPR: deprecate unit parameters ’T’, 't', 'L', and 'l' #53557
Conversation
@jbrockmendel, could you please take a look at this pr? |
pandas/core/tools/timedeltas.py
Outdated
@@ -181,6 +181,9 @@ def to_timedelta( | |||
"represent unambiguous timedelta values durations." | |||
) | |||
|
|||
if unit in {"t", "T", "l", "L"}: | |||
raise ValueError("Units 't', 'T', 'l' and 'L' are no longer supported.") |
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.
Thanks for working on this - there should probably be a FutureWarning first, and then in version 3.0 these units can raise
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.
Thanks for the comment. I’ll replace raising ValueError with FutureWarning.
along with these i think we need to track down other places where we use/allow these codes. _attrname_to_abbrevs/_abbrev_to_attrnames and Tick._prefix come to mind. Doesn't need to be this PR, but hopefully a follow-on |
b089fa0
to
d2a673f
Compare
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.
Nice one!
Test failures are probably unrelated, if we fetch/merge upstream/main after they're fixed then hopefully it'll all be good
Thank you @MarcoGorelli for reviewing this pr. |
merging then, thanks! |
) * BUG: add ’T’ to UnitChoices to fix incorrect unit validation in to_timedelta() * deprecate units T, t, L, l and fix tests * raise FutureWarning instead of ValueError * correct the to_timedelta definition and add a test for the warning --------- Co-authored-by: Marco Edward Gorelli <marcogorelli@protonmail.com>
) * BUG: add ’T’ to UnitChoices to fix incorrect unit validation in to_timedelta() * deprecate units T, t, L, l and fix tests * raise FutureWarning instead of ValueError * correct the to_timedelta definition and add a test for the warning --------- Co-authored-by: Marco Edward Gorelli <marcogorelli@protonmail.com>
Why do this? This is a pain in the ass for people |
looks like it comes from here |
Added upper case ’T’ for minutes in
UnitChoices
list. Now mypy doesn’t raise an error.Update:
Deprecated unit parameters ’T’, 't', 'L', 'l', and fixed test.