-
Notifications
You must be signed in to change notification settings - Fork 10
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
use pandas.to_timedelta function instead of invoking deprecated ctor arg #918
Conversation
…(unit argument will be gone)
Test Results2 188 tests ±0 2 187 ✅ +1 2m 45s ⏱️ -20s Results for commit 2e6c519. ± Comparison against base commit 82b79b1. This pull request removes 62 and adds 62 tests. Note that renamed tests count towards both.
♻️ This comment has been updated with latest results. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #918 +/- ##
==========================================
+ Coverage 96.45% 96.48% +0.03%
==========================================
Files 95 95
Lines 6287 6293 +6
==========================================
+ Hits 6064 6072 +8
+ Misses 223 221 -2 ☔ View full report in Codecov by Sentry. |
Thanks for the fixes @marscher ! what is the minimum pandas version required for this? |
I've added some backward compatibility code for reading old unit suffixes. Currently it only replaces the (used by weldx schema examples) suffix for seconds "S". I am not aware of any other units used in the past by weldx. To ensure we can still load old files with the new version, we should probably complete this list. |
@@ -9,6 +9,14 @@ | |||
__all__ = ["TimedeltaIndexConverter"] | |||
|
|||
|
|||
def _handle_converted_pd_tdi_units(node: TaggedDict): |
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.
backward compat @CagtayFabry
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.
changelog of pandas:
Units ‘H’, ‘T’, ‘S’, ‘L’, ‘U’ and ‘N’ are deprecated and will be removed in a future version. Please use ‘h’, ‘min’, ‘s’, ‘ms’, ‘us’, and ‘ns’ instead of ‘H’, ‘T’, ‘S’, ‘L’, ‘U’ and ‘N’.
Sorry I misinterpreted your question. I did not check, if it works with old Pandas versions. Is this a requirement or can we just pin a minimum version? |
I've tested pandas-1.5 with Python-3.11 locally and all tests pass. |
The CI failures are unrelated to my changes. I think this one is ready to go. |
If you tested it with 1.5 I am fine with pinning minimum pandas version >=1.5. 😊 |
Co-authored-by: Çağtay Fabry <cagtay.fabry@bam.de>
Changes
Pandas 2.2 deprecated the unit argument of the Timedeltaindex constructor and suggests to use pandas.totimedelta function instaed. This PR changes this as suggested.
Related Issues
properly fixes #909
Checks
CHANGELOG.md
tests/