Skip to content

Commit 6bace81

Browse files
authored
Merge pull request #77 from raisadz/feat/explode
feat: add `explode` and `sink_parquet`
2 parents ee8c162 + c115a47 commit 6bace81

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

narwhals_daft/dataframe.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828

2929
if TYPE_CHECKING:
3030
from collections.abc import Iterable, Iterator, Mapping, Sequence
31+
from io import BytesIO
32+
from pathlib import Path
3133
from types import ModuleType
3234

3335
from narwhals._compliant.typing import CompliantDataFrameAny
@@ -377,12 +379,16 @@ def group_by(
377379
) -> DaftLazyGroupBy:
378380
return DaftLazyGroupBy(self, keys, drop_null_keys=drop_null_keys)
379381

382+
def explode(self, columns: Sequence[str]) -> DaftLazyFrame:
383+
return self._with_native(self.native.explode(*columns))
384+
385+
def sink_parquet(self, file: str | Path | BytesIO) -> None:
386+
self.native.write_parquet(str(file))
387+
380388
gather_every = not_implemented.deprecated(
381389
"`LazyFrame.gather_every` is deprecated and will be removed in a future version."
382390
)
383391
join_asof = not_implemented()
384392
tail = not_implemented.deprecated(
385393
"`LazyFrame.tail` is deprecated and will be removed in a future version."
386394
)
387-
explode = not_implemented()
388-
sink_parquet = not_implemented()

run_tests.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,7 @@
3030
"test_dt_to_string_iso_local_datetime_expr",
3131
"test_empty_scalar_reduction_with_columns",
3232
"test_explode_invalid_operation_error",
33-
"test_explode_multiple_cols",
3433
"test_explode_shape_error",
35-
"test_explode_single_col",
3634
"test_expr_binary",
3735
"test_expr_floordiv_by_zero",
3836
"test_expr_rfloordiv_by_zero",

0 commit comments

Comments
 (0)