Skip to content

Commit

Permalink
feat(pandas/dask): implement flatten
Browse files Browse the repository at this point in the history
  • Loading branch information
cpcloud authored and kszucs committed Nov 21, 2023
1 parent d3c754f commit c2e8d9d
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions ibis/backends/pandas/execution/arrays.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from __future__ import annotations

import itertools
import operator
from functools import partial
from typing import TYPE_CHECKING, Any
Expand Down Expand Up @@ -147,3 +148,10 @@ def execute_array_collect_groupby(op, data, where, aggcontext=None, **kwargs):
@execute_node.register(ops.Unnest, pd.Series)
def execute_unnest(op, data, **kwargs):
return data.explode()


@execute_node.register(ops.ArrayFlatten, pd.Series)
def execute_array_flatten(op, data, **kwargs):
return data.map(
lambda v: list(itertools.chain.from_iterable(v)), na_action="ignore"
)

0 comments on commit c2e8d9d

Please sign in to comment.