Skip to content

Commit c2e8d9d

Browse files
cpcloudkszucs
authored andcommitted
feat(pandas/dask): implement flatten
1 parent d3c754f commit c2e8d9d

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

ibis/backends/pandas/execution/arrays.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from __future__ import annotations
22

3+
import itertools
34
import operator
45
from functools import partial
56
from typing import TYPE_CHECKING, Any
@@ -147,3 +148,10 @@ def execute_array_collect_groupby(op, data, where, aggcontext=None, **kwargs):
147148
@execute_node.register(ops.Unnest, pd.Series)
148149
def execute_unnest(op, data, **kwargs):
149150
return data.explode()
151+
152+
153+
@execute_node.register(ops.ArrayFlatten, pd.Series)
154+
def execute_array_flatten(op, data, **kwargs):
155+
return data.map(
156+
lambda v: list(itertools.chain.from_iterable(v)), na_action="ignore"
157+
)

0 commit comments

Comments
 (0)