From 7bfb7764d7ade3cf0753ee759379f090d47e6f41 Mon Sep 17 00:00:00 2001 From: Liam Connors Date: Mon, 9 Sep 2024 03:04:53 -0400 Subject: [PATCH] feat: implement `to_arrow` for cuDF (#924) * xfail to_arrow tests for cuDF * Revert "xfail to_arrow tests for cuDF" This reverts commit d695efd210fb30b2e2e5beea84a67d25836f152b. * implement to_arrow for cuDF --- narwhals/_pandas_like/dataframe.py | 3 +-- narwhals/_pandas_like/series.py | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/narwhals/_pandas_like/dataframe.py b/narwhals/_pandas_like/dataframe.py index 880e2d140..ce0cae8ac 100644 --- a/narwhals/_pandas_like/dataframe.py +++ b/narwhals/_pandas_like/dataframe.py @@ -672,8 +672,7 @@ def gather_every(self: Self, n: int, offset: int = 0) -> Self: def to_arrow(self: Self) -> Any: if self._implementation is Implementation.CUDF: # pragma: no cover - msg = "`to_arrow` is not implemented for CuDF backend." - raise NotImplementedError(msg) + return self._native_frame.to_arrow(preserve_index=False) import pyarrow as pa # ignore-banned-import() diff --git a/narwhals/_pandas_like/series.py b/narwhals/_pandas_like/series.py index e94c95a8c..b28a04088 100644 --- a/narwhals/_pandas_like/series.py +++ b/narwhals/_pandas_like/series.py @@ -635,8 +635,7 @@ def clip( def to_arrow(self: Self) -> Any: if self._implementation is Implementation.CUDF: # pragma: no cover - msg = "`to_arrow` is not implemented for CuDF backend." - raise NotImplementedError(msg) + return self._native_series.to_arrow() import pyarrow as pa # ignore-banned-import()