Skip to content

Commit

Permalink
old versions
Browse files Browse the repository at this point in the history
  • Loading branch information
FBruzzesi committed Dec 9, 2024
1 parent 3b52ab5 commit c3bf009
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion narwhals/_arrow/dataframe.py
Original file line number Diff line number Diff line change
Expand Up @@ -807,7 +807,7 @@ def explode_null_array(array: pa.ChunkedArray) -> pa.ChunkedArray:
flatten_func = explode_null_array

arrays = [
native_frame[col_name].take(indices=indices)
native_frame[col_name].take(indices)
if col_name in other_columns
else flatten_func(native_frame[col_name])
for col_name in original_columns
Expand Down
14 changes: 14 additions & 0 deletions tests/frame/explode_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
import narwhals.stable.v1 as nw
from narwhals.exceptions import InvalidOperationError
from narwhals.exceptions import ShapeError
from tests.utils import PANDAS_VERSION
from tests.utils import POLARS_VERSION
from tests.utils import Constructor
from tests.utils import assert_equal_data

Expand Down Expand Up @@ -38,6 +40,9 @@ def test_explode_single_col(
if any(backend in str(constructor) for backend in ("dask", "modin", "cudf")):
request.applymarker(pytest.mark.xfail)

if "pandas" in str(constructor) and PANDAS_VERSION < (2, 2):
request.applymarker(pytest.mark.xfail)

result = (
nw.from_native(constructor(data))
.with_columns(nw.col("l1", "l2", "l3").cast(nw.List(nw.Int32())))
Expand All @@ -64,6 +69,9 @@ def test_explode_multiple_cols(
if any(backend in str(constructor) for backend in ("dask", "modin", "cudf")):
request.applymarker(pytest.mark.xfail)

if "pandas" in str(constructor) and PANDAS_VERSION < (2, 2):
request.applymarker(pytest.mark.xfail)

result = (
nw.from_native(constructor(data))
.with_columns(nw.col("l1", "l2", "l3").cast(nw.List(nw.Int32())))
Expand All @@ -84,6 +92,9 @@ def test_explode_shape_error(
if any(backend in str(constructor) for backend in ("dask", "modin", "cudf")):
request.applymarker(pytest.mark.xfail)

if "pandas" in str(constructor) and PANDAS_VERSION < (2, 2):
request.applymarker(pytest.mark.xfail)

with pytest.raises(
(ShapeError, PlShapeError),
match="exploded columns must have matching element counts",
Expand All @@ -103,6 +114,9 @@ def test_explode_invalid_operation_error(
if "dask" in str(constructor):
request.applymarker(pytest.mark.xfail)

if "polars" in str(constructor) and POLARS_VERSION < (0, 20, 6):
request.applymarker(pytest.mark.xfail)

with pytest.raises(
(InvalidOperationError, PlInvalidOperationError),
match="`explode` operation not supported for dtype",
Expand Down

0 comments on commit c3bf009

Please sign in to comment.