-
-
Notifications
You must be signed in to change notification settings - Fork 2.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
pl.struct with literal List field #8062
Comments
It looks like |
I may have a solution here; the problem with providing a list literal (given the existing Series behaviour inside |
0.17.3 was just released with another related regression. I can no longer use import polars as pl
pl.DataFrame({"a": [1, 2, 3]}).select(
pl.struct(
[
pl.col("a"),
pl.lit([[]]).alias("b"),
],
schema={"a": pl.Int64, "b": pl.List(pl.Int64)},
)
) Previously on 0.17.2 or up to f7ea104, it would output
Now on 0.17.3 or after 9a73d3c,
No combination of |
Hmm. I'll take a look at all of this tomorrow and see if I can consolidate/fix 😅 |
I think we must document this better in The other issue is the cast due to the |
Thanks @ritchie46! I'll checkout the fix. |
Polars version checks
Issue description
Using
pl.struct
with a mix of expressions and literals mostly works as expected. There's a specific issue I ran into when one of the struct fields is a list.The issue might possibly be related to #7299 as I'm seeing these list columns flattened into a series of their inner type before the unit series is expanded to match the frame's height.
Reproducible example
Expected behavior
Installed versions
The text was updated successfully, but these errors were encountered: