diff --git a/dask_expr/expr.py b/dask_expr/expr.py index 7f04c818..192aee52 100644 --- a/dask_expr/expr.py +++ b/dask_expr/expr.py @@ -366,6 +366,9 @@ def count(self, numeric_only=None): def astype(self, dtypes): return AsType(self, dtypes) + def isna(self): + return IsNa(self) + def apply(self, function, *args, **kwargs): return Apply(self, function, args, kwargs) @@ -731,6 +734,11 @@ class AsType(Elemwise): operation = M.astype +class IsNa(Elemwise): + _parameters = ["frame"] + operation = M.isna + + class Apply(Elemwise): """A good example of writing a less-trivial blockwise operation""" diff --git a/dask_expr/tests/test_collection.py b/dask_expr/tests/test_collection.py index e8fd5ce0..a4ea519c 100644 --- a/dask_expr/tests/test_collection.py +++ b/dask_expr/tests/test_collection.py @@ -124,6 +124,8 @@ def test_conditionals(func, pdf, df): lambda df: df.apply(lambda row, x, y=10: row * x + y, x=2), lambda df: df[df.x > 5], lambda df: df.assign(a=df.x + df.y, b=df.x - df.y), + lambda df: df.isna(), + lambda df: df.x.isna(), ], ) def test_blockwise(func, pdf, df):