From 166c49e534efd4c15d185ef3fd85fc979c839f66 Mon Sep 17 00:00:00 2001 From: raisadz <34237447+raisadz@users.noreply.github.com> Date: Thu, 15 Aug 2024 13:35:02 +0100 Subject: [PATCH] add dask diff method (#793) --- narwhals/_dask/expr.py | 7 +++++++ tests/expr_and_series/diff_test.py | 2 -- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/narwhals/_dask/expr.py b/narwhals/_dask/expr.py index c111b5153..941f0e7a4 100644 --- a/narwhals/_dask/expr.py +++ b/narwhals/_dask/expr.py @@ -485,6 +485,13 @@ def clip( returns_scalar=False, ) + def diff(self: Self) -> Self: + return self._from_call( + lambda _input: _input.diff(), + "diff", + returns_scalar=False, + ) + def n_unique(self: Self) -> Self: return self._from_call( lambda _input: _input.nunique(dropna=False), diff --git a/tests/expr_and_series/diff_test.py b/tests/expr_and_series/diff_test.py index 41f59c34d..f38b96e00 100644 --- a/tests/expr_and_series/diff_test.py +++ b/tests/expr_and_series/diff_test.py @@ -15,8 +15,6 @@ def test_diff(constructor: Any, request: Any) -> None: - if "dask" in str(constructor): - request.applymarker(pytest.mark.xfail) if "pyarrow_table_constructor" in str(constructor) and parse_version( pa.__version__ ) < (13,):