Skip to content

Commit

Permalink
is_duckdb, is_ibis
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcoGorelli committed Jan 5, 2025
1 parent ee0d758 commit 23d4ab5
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions narwhals/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,38 @@ def is_dask(self) -> bool:
"""
return self is Implementation.DASK # pragma: no cover

def is_duckdb(self) -> bool:
"""Return whether implementation is DuckDB.
Returns:
Boolean.
Examples:
>>> import polars as pl
>>> import narwhals as nw
>>> df_native = pl.DataFrame({"a": [1, 2, 3]})
>>> df = nw.from_native(df_native)
>>> df.implementation.is_duckdb()
False
"""
return self is Implementation.DUCKDB # pragma: no cover

def is_ibis(self) -> bool:
"""Return whether implementation is Ibis.
Returns:
Boolean.
Examples:
>>> import polars as pl
>>> import narwhals as nw
>>> df_native = pl.DataFrame({"a": [1, 2, 3]})
>>> df = nw.from_native(df_native)
>>> df.implementation.is_ibis()
False
"""
return self is Implementation.IBIS # pragma: no cover


MIN_VERSIONS: dict[Implementation, tuple[int, ...]] = {
Implementation.PANDAS: (0, 25, 3),
Expand Down

0 comments on commit 23d4ab5

Please sign in to comment.