Skip to content

Improve warning message and tests for timedelta decoding #10508

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

shoyer
Copy link
Member

@shoyer shoyer commented Jul 7, 2025

The new warning message gives years clearer and simpler guidance on how to silence the warning.

The new tests verify that dtype attributes on disk like timedelta64[s] will be decoded properly.

The new warning message gives years clearer and simpler guidance on
how to silence the warning.

The new tests verify that `dtype` attributes on disk like
`timedelta64[s]` will be decoded properly.
Copy link
Member

@spencerkclark spencerkclark left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, looks good!

This might be sufficient to close #10382. My main takeaway there was that it would be good to include at least one variable name that triggered the warning, which is what this PR does.

) -> None:
timedeltas = pd.timedelta_range(0, freq="D", periods=3)
timedeltas = pd.timedelta_range(0, freq="D", periods=3, unit=original_unit)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not fully understand why mypy complains here, but we have worked around it this way in the past:

Suggested change
timedeltas = pd.timedelta_range(0, freq="D", periods=3, unit=original_unit)
timedeltas = pd.timedelta_range(0, freq="D", periods=3, unit=original_unit) # type: ignore[call-arg]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants