Skip to content

Commit 3c8b34b

Browse files
committed
wip readind daft df
1 parent 46ea6cb commit 3c8b34b

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

narwhals/_namespace.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
get_pandas,
2222
get_polars,
2323
get_pyarrow,
24+
is_daft_dataframe,
2425
is_dask_dataframe,
2526
is_duckdb_relation,
2627
is_ibis_table,
@@ -124,6 +125,9 @@ def where(self, cond: Any, other: Any = ..., **kwds: Any) -> Any: ...
124125
class _NativeDask(Protocol):
125126
_partition_type: type[pd.DataFrame]
126127

128+
# TODO @mp
129+
class _NativeDaft(Protocol): ...
130+
127131
class _CuDFDataFrame(_BasePandasLikeFrame, Protocol):
128132
def to_pylibcudf(self, *args: Any, **kwds: Any) -> Any: ...
129133

@@ -371,6 +375,9 @@ def from_native_object(
371375
if is_native_pyspark_connect(native)
372376
else Implementation.PYSPARK
373377
)
378+
elif is_native_daft(native): # pragma: no cover
379+
# TODO @mp fix this!
380+
impl = Implementation.DAFT
374381
elif is_native_dask(native): # pragma: no cover
375382
impl = Implementation.DASK
376383
elif is_native_duckdb(native):
@@ -399,6 +406,10 @@ def is_native_arrow(obj: Any) -> TypeIs[_NativeArrow]:
399406
)
400407

401408

409+
def is_native_daft(obj: Any) -> TypeIs[_NativeDaft]:
410+
return is_daft_dataframe(obj)
411+
412+
402413
def is_native_dask(obj: Any) -> TypeIs[_NativeDask]:
403414
return is_dask_dataframe(obj)
404415

narwhals/_utils.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,8 @@ class Implementation(NoAutoEnum):
300300
"""PySpark implementation."""
301301
POLARS = "polars"
302302
"""Polars implementation."""
303+
DAFT = "daft"
304+
"""Daft implementation."""
303305
DASK = "dask"
304306
"""Dask implementation."""
305307
DUCKDB = "duckdb"

0 commit comments

Comments
 (0)