-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: rework README, remove ibis comparison (#522)
* docs: rework README, remove ibis comparison * add levels page * add levels page
- Loading branch information
1 parent
5a597ca
commit a9abd1b
Showing
5 changed files
with
53 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# Levels | ||
|
||
Narwhals comes with two levels of support: "full" and "interchange". | ||
|
||
Libraries for which we have full support can benefit from the whole | ||
[Narwhals API](https://narwhals-dev.github.io/narwhals/api-reference/). | ||
|
||
For example: | ||
|
||
```python exec="1" source="above" | ||
import narwhals as nw | ||
from narwhals.typing import FrameT | ||
|
||
@nw.narwhalify | ||
def func(df: FrameT) -> FrameT: | ||
return df.group_by('a').agg( | ||
b_mean=nw.col('b').mean(), | ||
b_std=nw.col('b').std(), | ||
) | ||
``` | ||
will work for any of pandas, Polars, cuDF, and Modin. | ||
|
||
However, sometimes you don't need to do complex operations on dataframes - all you need | ||
is to inspect the schema a bit before making other decisions, such as which columns to | ||
select or whether to convert to another library. For that purpose, we also provide "interchange" | ||
level of support. If a library implements the | ||
[Dataframe Interchange Protocol](https://data-apis.org/dataframe-protocol/latest/), then | ||
a call such as | ||
|
||
```python exec="1" source="above" | ||
import narwhals as nw | ||
from narwhals.schema import Schema | ||
|
||
|
||
def func(df_any: Any) -> Schema: | ||
df = nw.from_native(df, eager_or_interchange_only=True) | ||
return df.schema | ||
``` | ||
is also supported, meaning that, in addition to the libraries mentioned above, you can | ||
also pass Ibis, Vaex, PyArrow, and any other library which implements the protocol. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,7 @@ version = "1.0.6" | |
authors = [ | ||
{ name="Marco Gorelli", email="[email protected]" }, | ||
] | ||
description = "Extremely lightweight compatibility layer between pandas, Polars, cuDF, and Modin" | ||
description = "Extremely lightweight compatibility layer between dataframe libraries" | ||
readme = "README.md" | ||
requires-python = ">=3.8" | ||
classifiers = [ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters