Skip to content

Commit 421494c

Browse files
committed
docs fixups
1 parent b44d749 commit 421494c

File tree

6 files changed

+24
-11
lines changed

6 files changed

+24
-11
lines changed

demo.py

+3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# ruff: noqa
22
from typing import Any
33
import polars as pl
4+
import modin.pandas as mpd
45

56
import narwhals as nw
67

@@ -23,6 +24,8 @@ def func(df_raw: nw.typing.T) -> nw.typing.T:
2324

2425
df = pd.DataFrame({"a": [1, 1, 3], "b": [4, 5, 6], "c": [7, 8, 9]})
2526
print(func(df))
27+
df = mpd.DataFrame({"a": [1, 1, 3], "b": [4, 5, 6], "c": [7, 8, 9]})
28+
print(func(df))
2629
df = pl.DataFrame({"a": [1, 1, 3], "b": [4, 5, 6], "c": [7, 8, 9]})
2730
print(func(df))
2831
df = pl.LazyFrame({"a": [1, 1, 3], "b": [4, 5, 6], "c": [7, 8, 9]})

docs/index.md

+9-9
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
# Narwhals
22

3-
Extremely lightweight compatibility layer between pandas and Polars:
3+
![](assets/image.png)
44

5-
- ✅ No dependencies.
6-
- ✅ Lightweight: wheel is smaller than 30 kB.
7-
- ✅ Simple, minimal, and predictable.
5+
Extremely lightweight compatibility layer between Polars, pandas, and more.
86

9-
No need to choose - support both with ease!
7+
Seamlessly support both, without depending on either!
8+
9+
-**Just use** a subset of **the Polars API**, no need to learn anything new
10+
-**No dependencies** (not even Polars), keep your library lightweight
11+
- ✅ Support both **lazy** and eager execution
12+
- ✅ Use Polars **Expressions**
1013

1114
## Who's this for?
1215

1316
Anyone wishing to write a library/application/service which consumes dataframes, and wishing to make it
1417
completely dataframe-agnostic.
1518

16-
## Let's get started!
17-
18-
- [Installation](installation.md)
19-
- [Quick start](quick_start.md)
19+
Let's get started!

docs/quick_start.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
## Prerequisites
44

5-
Please start by following the [installation instructions](installation.md)
5+
Please start by following the [installation instructions](installation.md).
66

77
Then, please install the following:
88

mkdocs.yml

+4
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ nav:
1212
theme:
1313
name: material
1414
font: false
15+
features:
16+
- content.code.copy
17+
- content.code.annotate
18+
- navigation.footer
1519
plugins:
1620
- search
1721
- mkdocstrings

narwhals/dataframe.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
from narwhals.dtypes import to_narwhals_dtype
1111
from narwhals.pandas_like.dataframe import PandasDataFrame
12+
from narwhals.translate import get_modin
1213
from narwhals.translate import get_pandas
1314
from narwhals.translate import get_polars
1415

@@ -56,8 +57,11 @@ def __init__(
5657
elif (pd := get_pandas()) is not None and isinstance(df, pd.DataFrame):
5758
self._dataframe = PandasDataFrame(df, implementation="pandas")
5859
self._implementation = "pandas"
60+
elif (mpd := get_modin()) is not None and isinstance(df, mpd.DataFrame):
61+
self._dataframe = PandasDataFrame(df, implementation="modin")
62+
self._implementation = "modin"
5963
else:
60-
msg = f"Expected pandas or Polars dataframe or lazyframe, got: {type(df)}"
64+
msg = f"Expected pandas-like dataframe, Polars dataframe, or Polars lazyframe, got: {type(df)}"
6165
raise TypeError(msg)
6266
_validate_features(self._dataframe, self._features)
6367

narwhals/translate.py

+2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
from typing import TYPE_CHECKING
44

5+
from narwhals.dependencies import get_modin
56
from narwhals.dependencies import get_pandas
67
from narwhals.dependencies import get_polars
78

@@ -31,5 +32,6 @@ def to_native(obj: DataFrame[T] | Series[T]) -> T:
3132
__all__ = [
3233
"get_pandas",
3334
"get_polars",
35+
"get_modin",
3436
"to_native",
3537
]

0 commit comments

Comments
 (0)