Skip to content

fix: preserve label add_data precision after PR #279#280

Merged
behackl merged 1 commit into
UniGrazMath:mainfrom
behackl:fix/label-add-data-ns-upcast
Apr 12, 2026
Merged

fix: preserve label add_data precision after PR #279#280
behackl merged 1 commit into
UniGrazMath:mainfrom
behackl:fix/label-add-data-ns-upcast

Conversation

@behackl
Copy link
Copy Markdown
Contributor

@behackl behackl commented Apr 11, 2026

Follow-up to #279.

Label.add_data() needs a small precision fix: inserting a sub-second Timedelta into a label with timedelta64[s] index should preserve fractional seconds, but we also must not downcast existing higher-resolution entries.

This keeps the implementation simple by normalizing non-empty label time_index values to timedelta64[ns] before searchsorted / insert. It also adds two focused regression tests: one for the original 1.5s case and one to ensure existing ns-precision entries stay intact.

Local validation:

  • uv run pytest tests/test_timeseries.py -q

@behackl behackl merged commit becafc2 into UniGrazMath:main Apr 12, 2026
10 checks passed
@behackl behackl deleted the fix/label-add-data-ns-upcast branch April 12, 2026 06:36
@sorlob
Copy link
Copy Markdown
Collaborator

sorlob commented Apr 14, 2026

fixes #278

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.

2 participants