Skip to content

Commit

Permalink
Add isna (#76)
Browse files Browse the repository at this point in the history
  • Loading branch information
jrbourbeau authored May 10, 2023
1 parent 3a45f2e commit 6e4296d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
8 changes: 8 additions & 0 deletions dask_expr/expr.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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"""

Expand Down
2 changes: 2 additions & 0 deletions dask_expr/tests/test_collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit 6e4296d

Please sign in to comment.