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
|
@FBruzzesi I'm coming back to this after my recent fiddling with Updated: Yep, it works! 🥳 (#3347) Regarding: (#1644 (comment)) 3 weeks ago on that issue (pola-rs/polars#17664 (comment))
So now def explode(
self,
columns: ColumnNameOrSelector | Iterable[ColumnNameOrSelector],
*more_columns: ColumnNameOrSelector,
empty_as_null: bool = True,
keep_nulls: bool = True,
) -> DataFrame: |
Mentioned in (#1644 (comment)) Multi-column coming up next 😄
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