Skip to content

Commit

Permalink
extending
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcoGorelli committed Mar 17, 2024
1 parent 11ef9b6 commit 64a4093
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions docs/extending.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# How Narwhals can support your dataframe as well!

1 change: 1 addition & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ nav:
- basics/dataframe.md
- basics/column.md
- basics/complete_example.md
- Extending: extending.md
- API Reference: reference.md
theme:
name: material
Expand Down
3 changes: 3 additions & 0 deletions narwhals/dataframe.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,9 @@ def __init__(
): # pragma: no cover
self._dataframe = PandasDataFrame(df, implementation="cudf")
self._implementation = "cudf"
elif hasattr(df, "__narwhals_dataframe__"):
self._dataframe = df.__narwhals_dataframe__()
self._implementation = "custom"
else:
msg = f"Expected pandas-like dataframe, Polars dataframe, or Polars lazyframe, got: {type(df)}"
raise TypeError(msg)
Expand Down

0 comments on commit 64a4093

Please sign in to comment.