-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Allow join on different types if upcast is safe #15338
Comments
This could also be a kwargs that defaults to false, so that polars by itself does no type conversion, but users can opt into safe upcasts if the want to |
Is there any progress on this feature? In our company, many data types are uncertain, which has become an obstacle for me in promoting Polars internally. In Pandas, this operation succeeds without error: import pandas as pd
df1 = pd.DataFrame({'a': list(range(5))})
df2 = df1.copy()
df2['a'] = df1['a'].astype("UInt8")
result = pd.merge(df1, df2, on='a') Pandas handles the type mismatch by implicitly casting the join keys, allowing the merge to succeed. |
We will look into this. Indeed between integer <-> integers it is safe (floats not so much). |
Is there maybe a way to instead have a |
That would need to be called before, and return a struct. (if it would be done in the separate expressions it would be way too magic for my liking. I think this is fine as we type resolve more operations. |
Yes, please can we have this! I'm having a tough time mixing |
This would be a great feature. In my case, I wrote a function to cast all integer columns to i64 as an initial step to circumvent this issue before performing any further operations. |
Description
It would be nice to allow joining between different data types when upcast is safe, for example i{8,16,32}->i64, u{8,16,32}->u64 etc
Example:
Currently both of these error with an exception like
The text was updated successfully, but these errors were encountered: