Skip to content

Commit 3c6fa8c

Browse files
anopsyMarcoGorelli
andauthored
feat: add NotImplementedError error for index changing methods Dask (#744)
* add notImplemented error for index changing methods Dask * add NotImplementedError to index changing methods Dask * add NotImplementedError in Dask drop_null/count * Update expr.py --------- Co-authored-by: Marco Edward Gorelli <marcogorelli@protonmail.com>
1 parent 5c9c54c commit 3c6fa8c

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

narwhals/_dask/expr.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from typing import TYPE_CHECKING
55
from typing import Any
66
from typing import Callable
7+
from typing import NoReturn
78

89
from narwhals.dependencies import get_dask
910

@@ -420,6 +421,16 @@ def round(self, decimals: int) -> Self:
420421
returns_scalar=False,
421422
)
422423

424+
def drop_nulls(self) -> NoReturn:
425+
# We can't (yet?) allow methods which modify the index
426+
msg = "`Expr.drop_nulls` is not supported for the Dask backend. Please use `LazyFrame.drop_nulls` instead."
427+
raise NotImplementedError(msg)
428+
429+
def sort(self, *, descending: bool = False, nulls_last: bool = False) -> NoReturn:
430+
# We can't (yet?) allow methods which modify the index
431+
msg = "`Expr.sort` is not supported for the Dask backend. Please use `LazyFrame.sort` instead."
432+
raise NotImplementedError(msg)
433+
423434
def abs(self) -> Self:
424435
return self._from_call(
425436
lambda _input: _input.abs(),

0 commit comments

Comments
 (0)