Skip to content

Commit

Permalink
fix dask issue
Browse files Browse the repository at this point in the history
  • Loading branch information
FBruzzesi committed Aug 15, 2024
1 parent 11105aa commit 5687026
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
11 changes: 5 additions & 6 deletions narwhals/_dask/dataframe.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,14 +129,13 @@ def drop_nulls(
)

column_names = [c for c in subset_ if isinstance(c, str)]
selectors = [c.is_null()._call(plx) for c in subset_ if isinstance(c, Selector)]
selector_names = self.select(
*[c.is_null()._call(plx) for c in subset_ if isinstance(c, Selector)]
).columns

result = (
self.filter(~plx.any_horizontal(plx.col(*column_names).is_null()))
if column_names
else self
return self._from_native_frame(
self._native_frame.dropna(subset=list(set(*column_names, *selector_names)))
)
return result.filter(~plx.any_horizontal(*selectors)) if selectors else result

@property
def schema(self) -> dict[str, DType]:
Expand Down
2 changes: 1 addition & 1 deletion narwhals/_pandas_like/dataframe.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ def drop_nulls(
selectors = [c.is_null()._call(plx) for c in subset_ if isinstance(c, Selector)]

result = (
self.filter(~plx.any_horizontal(plx.col(*column_names).is_null()))
(self._from_native_frame(self._native_frame.dropna(subset=column_names)))
if column_names
else self
)
Expand Down

0 comments on commit 5687026

Please sign in to comment.