-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
No error thrown when using clip
on int column with float bounds
#11385
Comments
Could you fix the test case? |
Oops sorry, it now works :) |
Not sure what the right way to go is here. We could have |
I guess, either autocasting to the higher of the precisions or throwing a type mismatch error would be two legitimate options. I'm worried now that a simple warning would be too quiet and I cannot think of too many use-cases where having values wrongly clipped is ok? |
I would assume |
Similar issue, no warning with Series.scatter(), scattering float values into an int column. |
I guess we should strict cast the inputs to the type of the column, rather than regular cast. That would raise an error with bad inputs and require you to cast the column manually first. EDIT: Actually, we should use supertypes here. EDIT2: Actually, we should not upcast the original column... |
clip
on int column with float bounds
Description
Hi,
I have this situation occurring to me and I think that polars throwing an error would have helped me debug.
The error must be happening because of various casting of ints and floats and adding a
.cast(pl.Float32)
seems to fix the issue. But in my actual use case, this operation was hidden within a more convoluted DataFrame operation so it was harder to track the origin of my bug. Maybe having polars throw a warning here would help? Something about boundaries not respected because of type mismatch?Thanks for the work on polars!
The text was updated successfully, but these errors were encountered: