-
-
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
separate pl.list()
and pl.concat_list
#17307
Comments
This is the exact semantics I want! Except may I recommend the signature of list() be We are solving this exact same thing in ibis-project/ibis#9473 |
This was discussed in the linked issue. I don't believe adding a separate |
@stinodego how would one collect a list of df = pl.DataFrame({
"a": [[1, 2, 3]],
"b": [[4, 5, 6]],
}) concatenating the columns into a list:
AFAIK there's no way to do this, because |
See my comment in the linked issue, it describes exactly what @mcrumiller talks about, we would need to add special-casing code to ibis in order to be able to support this. |
Description
Edit: I just noticed there is more to the documentation in 1.0 which isn't on the current 0.20 documentation, which clarifies that non-list dtypes are cast to lists prior to concatenation, but my proposal still stands.
Edit 2: found #8510 which seems to be the same issue/request. I'll wait for @stinodego's feedback before closing.
The description of
pl.concat_list
is:This is confusing, as discussed in #17294, since the name might imply concatenating existing lists into a single list. This is the current behavior on lists:
However,
concat_list
also concatenates the values in columns into lists:Note that the result of the operation in both cases is identical. Instead, I propose that we have:
pl.list(a, b, ...)
which creates a newpl.List
column out of the expressionsa, b, ...
. The dtypes must have a common supertype.pl.concat_list(a, b, ...)
wherea, b, ...
must all bepl.List
columns, and they are concatenated into a single list. The inner dtypes must have a common supertype.The text was updated successfully, but these errors were encountered: