Skip to content

fix: use ms precision for Time-based resampler to support pandas 2.2+#9

Merged
SimonHH merged 1 commit into
devfrom
claude/fix-upsample-downsample-tests-2CAqr
May 8, 2026
Merged

fix: use ms precision for Time-based resampler to support pandas 2.2+#9
SimonHH merged 1 commit into
devfrom
claude/fix-upsample-downsample-tests-2CAqr

Conversation

@SimonHH
Copy link
Copy Markdown
Owner

@SimonHH SimonHH commented May 8, 2026

In pandas 2.2+, pd.to_timedelta(x, unit='s') creates a timedelta64[s] index. Resampling at sub-second intervals then fails because the bin endpoint (e.g. 500ms) cannot be losslessly cast to seconds precision.

Switch to milliseconds for both the time index and the resample offset string, which gives sufficient precision for sub-second intervals and removes the now-unnecessary pandas version-check workaround.

In pandas 2.2+, pd.to_timedelta(x, unit='s') creates a timedelta64[s]
index. Resampling at sub-second intervals then fails because the bin
endpoint (e.g. 500ms) cannot be losslessly cast to seconds precision.

Switch to milliseconds for both the time index and the resample offset
string, which gives sufficient precision for sub-second intervals and
removes the now-unnecessary pandas version-check workaround.

https://claude.ai/code/session_01WvnvMa5iWDmswWc7PwbZNQ
@SimonHH SimonHH merged commit 0d62c39 into dev May 8, 2026
@SimonHH SimonHH deleted the claude/fix-upsample-downsample-tests-2CAqr branch May 8, 2026 14:37
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