BAMWelDX / weldx

The welding data exchange format
https://www.bam.de/weldx
BSD 3-Clause "New" or "Revised" License
19 stars 9 forks source link

use pandas.to_timedelta function instead of invoking deprecated ctor arg #918

Closed marscher closed 3 months ago

marscher commented 4 months ago

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

github-actions[bot] commented 4 months ago

Test Results

2 188 tests  ±0   2 187 :white_check_mark: +1   2m 45s :stopwatch: -20s     1 suites ±0       1 :zzz: ±0      1 files   ±0       0 :x:  - 1 

Results for commit 2e6c519c. ± Comparison against base commit 82b79b17.

This pull request removes 62 and adds 62 tests. Note that renamed tests count towards both. ``` weldx.tests.test_time.TestTime ‑ test_add_datetime[TimedeltaIndex-False-False-False] weldx.tests.test_time.TestTime ‑ test_add_datetime[TimedeltaIndex-False-False-True] weldx.tests.test_time.TestTime ‑ test_add_datetime[TimedeltaIndex-False-True-False] weldx.tests.test_time.TestTime ‑ test_add_datetime[TimedeltaIndex-False-True-True] weldx.tests.test_time.TestTime ‑ test_add_datetime[TimedeltaIndex-True-False-False] weldx.tests.test_time.TestTime ‑ test_add_datetime[TimedeltaIndex-True-False-True] weldx.tests.test_time.TestTime ‑ test_add_datetime[TimedeltaIndex-True-True-False] weldx.tests.test_time.TestTime ‑ test_add_datetime[TimedeltaIndex-True-True-True] weldx.tests.test_time.TestTime ‑ test_add_timedelta[TimedeltaIndex-h-False-False-False] weldx.tests.test_time.TestTime ‑ test_add_timedelta[TimedeltaIndex-h-False-False-True] … ``` ``` weldx.tests.test_time.TestTime ‑ test_add_datetime[to_timedelta-False-False-False] weldx.tests.test_time.TestTime ‑ test_add_datetime[to_timedelta-False-False-True] weldx.tests.test_time.TestTime ‑ test_add_datetime[to_timedelta-False-True-False] weldx.tests.test_time.TestTime ‑ test_add_datetime[to_timedelta-False-True-True] weldx.tests.test_time.TestTime ‑ test_add_datetime[to_timedelta-True-False-False] weldx.tests.test_time.TestTime ‑ test_add_datetime[to_timedelta-True-False-True] weldx.tests.test_time.TestTime ‑ test_add_datetime[to_timedelta-True-True-False] weldx.tests.test_time.TestTime ‑ test_add_datetime[to_timedelta-True-True-True] weldx.tests.test_time.TestTime ‑ test_add_timedelta[to_timedelta-h-False-False-False] weldx.tests.test_time.TestTime ‑ test_add_timedelta[to_timedelta-h-False-False-True] … ```

:recycle: This comment has been updated with latest results.

codecov[bot] commented 4 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 96.48%. Comparing base (1750f5d) to head (2e6c519). Report is 1 commits behind head on master.

Additional details and impacted files ```diff @@ 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 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

CagtayFabry commented 4 months ago

Thanks for the fixes @marscher !

what is the minimum pandas version required for this? Does it work with 1.5.x still?

marscher commented 4 months ago

what is the minimum pandas version required for this? Does it work with 1.5.x still?

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.

marscher commented 4 months ago

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?

marscher commented 4 months ago

I've tested pandas-1.5 with Python-3.11 locally and all tests pass.

marscher commented 4 months ago

The CI failures are unrelated to my changes. I think this one is ready to go.

CagtayFabry commented 4 months ago

I've tested pandas-1.5 with Python-3.11 locally and all tests pass.

If you tested it with 1.5 I am fine with pinning minimum pandas version >=1.5. 😊 I will update the CI to test for that later as well