Skip to content

Commit

Permalink
simplify dask imports
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcoGorelli committed Jan 20, 2025
1 parent d5619d8 commit 8637a5c
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 6 deletions.
5 changes: 1 addition & 4 deletions narwhals/_dask/dataframe.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from typing import Sequence

import dask.dataframe as dd
import pandas as pd

from narwhals._dask.utils import add_row_index
from narwhals._dask.utils import parse_exprs_and_named_exprs
Expand Down Expand Up @@ -81,8 +82,6 @@ def with_columns(self, *exprs: DaskExpr, **named_exprs: DaskExpr) -> Self:
return self._from_native_frame(df)

def collect(self) -> Any:
import pandas as pd

from narwhals._pandas_like.dataframe import PandasLikeDataFrame

result = self._native_frame.compute()
Expand Down Expand Up @@ -127,8 +126,6 @@ def select(

if not new_series:
# return empty dataframe, like Polars does
import pandas as pd

return self._from_native_frame(
dd.from_pandas(pd.DataFrame(), npartitions=self._native_frame.npartitions)
)
Expand Down
2 changes: 0 additions & 2 deletions narwhals/_dask/namespace.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,6 @@ def func(df: DaskLazyFrame) -> list[dx.Series]:
)

def len(self) -> DaskExpr:
import pandas as pd

def func(df: DaskLazyFrame) -> list[dx.Series]:
if not df.columns:
return [
Expand Down

0 comments on commit 8637a5c

Please sign in to comment.