-
Notifications
You must be signed in to change notification settings - Fork 147
feat: ArrowDataFrame.explode
#1644
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
base: main
Are you sure you want to change the base?
Conversation
β¦/narwhals into feat/explode-method
@FBruzzesi I feel like this shouldn't have got lost!
narwhals/narwhals/_arrow/dataframe.py Line 350 in 2bcc6bb
narwhals/narwhals/_arrow/dataframe.py Line 466 in 2bcc6bb
I might add a PR for narwhals/narwhals/_arrow/dataframe.py Line 669 in 2bcc6bb
|
Thanks @dangotbanned if fast_path:
indices = pc.list_parent_indices(native_frame[to_explode[0]])
flatten_func = pc.list_flatten
else:
filled_counts = pc.max_element_wise(counts, 1, skip_nulls=True)
indices = pa.array(
[
i
for i, count in enumerate(filled_counts.to_pylist())
for _ in range(count)
]
) |
Maybe we can figure out another path hidden somewhere in the stubs? π€ |
Mentioned in #1644 (comment) #2207
`.to_pylist` being called on a scalar is all that is left
It seems like If we had that behavior as the goal - I think |
Just leaving as-is, since this'll probably change in the future #1644 (comment)
> error: Incompatible redefinition (redefinition with type "Callable[[ChunkedArray[ListScalar[Any]]], ChunkedArray[Any]]", original type overloaded function) [misc] https://github.com/narwhals-dev/narwhals/actions/runs/14060304329/job/39369169923?pr=1644
What type of PR is this? (check all applicable)
Checklist
If you have comments or can explain your changes, please do so below
I will leave this as draft until we decide how to move forward.
To summarize the discussion(s) in #1542 :
.to_pylist()
call