-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Fix false timedelta decoding SerializationWarning
and improve warning message
#10072
base: main
Are you sure you want to change the base?
Fix false timedelta decoding SerializationWarning
and improve warning message
#10072
Conversation
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.
Looks good!
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.
I'm fully on-board with this change! This is much more informative now. Thanks @spencerkclark!
formatted_kwarg = f"{kwarg}={coder}(time_unit={new_time_unit!r})" | ||
message = ( | ||
f"Can't decode floating point {datatype} to {time_unit!r} " | ||
f"without precision loss; decoding to {new_time_unit!r} " | ||
f"instead. To silence this warning pass {formatted_kwarg} " | ||
f"to your opening function." | ||
) |
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.
👍
Co-authored-by: Mathias Hauser <[email protected]>
for more information, see https://pre-commit.ci
As reported in #10071, false warnings for resolution changes can be emitted when decoding timedeltas encoded with floating point values. In addition, the warning message could be clearer when resolution changes do occur. This PR fixes both issues.
The warning message in the event of a resolution change now reads:
whats-new.rst
cc: @kmuehlbauer