Skip to content

Commit 209e4e6

Browse files
authored
docs: replace remaining native_namespace refs (#2221)
#2218 (comment)
1 parent 4397220 commit 209e4e6

File tree

7 files changed

+13
-17
lines changed

7 files changed

+13
-17
lines changed

docs/basics/dataframe_conversion.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ which implements `__arrow_c_stream__`:
5252
```python exec="1" source="above" session="conversion" result="python"
5353
def df_to_polars(df_native: Any) -> pl.DataFrame:
5454
if hasattr(df_native, "__arrow_c_stream__"):
55-
return nw.from_arrow(df_native, native_namespace=pl).to_native()
55+
return nw.from_arrow(df_native, backend=pl).to_native()
5656
msg = (
5757
f"Expected object which implements '__arrow_c_stream__' got: {type(df_native)}"
5858
)
@@ -62,7 +62,7 @@ def df_to_polars(df_native: Any) -> pl.DataFrame:
6262
print(df_to_polars(df_duckdb)) # You can only execute this line of code once.
6363
```
6464

65-
It works to pass Polars to `native_namespace` here because Polars supports the [PyCapsule Interface](https://arrow.apache.org/docs/format/CDataInterface/PyCapsuleInterface.html) for import.
65+
It works to pass Polars to `backend` here because Polars supports the [PyCapsule Interface](https://arrow.apache.org/docs/format/CDataInterface/PyCapsuleInterface.html) for import.
6666

6767
Note that the PyCapsule Interface makes no guarantee that you can call it repeatedly, so the approach above only works if you
6868
only expect to perform the conversion a single time on each input object.

narwhals/dataframe.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,7 @@ class DataFrame(BaseFrame[DataFrameT]):
414414
```py
415415
narwhals.from_dict(
416416
data={"a": [1, 2, 3]},
417-
native_namespace=narwhals.get_native_namespace(another_object),
417+
backend=narwhals.get_native_namespace(another_object),
418418
)
419419
```
420420
"""

narwhals/functions.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -977,7 +977,7 @@ def read_parquet(
977977
see [perfect backwards compatibility policy](../backcompat.md/).
978978
kwargs: Extra keyword arguments which are passed to the native parquet reader.
979979
For example, you could use
980-
`nw.read_parquet('file.parquet', native_namespace=pd, engine='pyarrow')`.
980+
`nw.read_parquet('file.parquet', backend=pd, engine='pyarrow')`.
981981
982982
Returns:
983983
DataFrame.
@@ -1061,7 +1061,7 @@ def scan_parquet(
10611061
see [perfect backwards compatibility policy](../backcompat.md/).
10621062
kwargs: Extra keyword arguments which are passed to the native parquet reader.
10631063
For example, you could use
1064-
`nw.scan_parquet('file.parquet', native_namespace=pd, engine='pyarrow')`.
1064+
`nw.scan_parquet('file.parquet', backend=pd, engine='pyarrow')`.
10651065
10661066
Returns:
10671067
LazyFrame.

narwhals/series.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ class Series(Generic[IntoSeriesT]):
5858
narwhals.new_series(
5959
name=name,
6060
values=values,
61-
native_namespace=narwhals.get_native_namespace(another_object),
61+
backend=narwhals.get_native_namespace(another_object),
6262
)
6363
```
6464
"""

narwhals/stable/v1/__init__.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ class DataFrame(NwDataFrame[IntoDataFrameT]):
126126
```py
127127
narwhals.from_dict(
128128
data={"a": [1, 2, 3]},
129-
native_namespace=narwhals.get_native_namespace(another_object),
129+
backend=narwhals.get_native_namespace(another_object),
130130
)
131131
```
132132
"""
@@ -385,7 +385,7 @@ class Series(NwSeries[IntoSeriesT]):
385385
narwhals.new_series(
386386
name=name,
387387
values=values,
388-
native_namespace=narwhals.get_native_namespace(another_object),
388+
backend=narwhals.get_native_namespace(another_object),
389389
)
390390
```
391391
"""
@@ -2445,7 +2445,7 @@ def read_parquet(
24452445
see [perfect backwards compatibility policy](../backcompat.md/).
24462446
kwargs: Extra keyword arguments which are passed to the native parquet reader.
24472447
For example, you could use
2448-
`nw.read_parquet('file.parquet', native_namespace=pd, engine='pyarrow')`.
2448+
`nw.read_parquet('file.parquet', backend=pd, engine='pyarrow')`.
24492449
24502450
Returns:
24512451
DataFrame.
@@ -2486,7 +2486,7 @@ def scan_parquet(
24862486
see [perfect backwards compatibility policy](../backcompat.md/).
24872487
kwargs: Extra keyword arguments which are passed to the native parquet reader.
24882488
For example, you could use
2489-
`nw.scan_parquet('file.parquet', native_namespace=pd, engine='pyarrow')`.
2489+
`nw.scan_parquet('file.parquet', backend=pd, engine='pyarrow')`.
24902490
24912491
Returns:
24922492
LazyFrame.

tests/new_series_test.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,15 @@ def test_new_series(constructor_eager: ConstructorEager) -> None:
2626

2727
def test_new_series_v1(constructor_eager: ConstructorEager) -> None:
2828
s = nw_v1.from_native(constructor_eager({"a": [1, 2, 3]}), eager_only=True)["a"]
29-
result = nw_v1.new_series(
30-
"b", [4, 1, 2], native_namespace=nw_v1.get_native_namespace(s)
31-
)
29+
result = nw_v1.new_series("b", [4, 1, 2], backend=nw_v1.get_native_namespace(s))
3230
expected = {"b": [4, 1, 2]}
3331
# all supported libraries auto-infer this to be int64, we can always special-case
3432
# something different if necessary
3533
assert result.dtype == nw_v1.Int64
3634
assert_equal_data(result.to_frame(), expected)
3735

3836
result = nw_v1.new_series(
39-
"b", [4, 1, 2], nw_v1.Int32, native_namespace=nw_v1.get_native_namespace(s)
37+
"b", [4, 1, 2], nw_v1.Int32, backend=nw_v1.get_native_namespace(s)
4038
)
4139
expected = {"b": [4, 1, 2]}
4240
assert result.dtype == nw_v1.Int32

tpch/execute.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,7 @@ def execute_query(query_id: str) -> None:
100100
result: pl.DataFrame = (
101101
query_module.query(
102102
*(
103-
nw.scan_parquet(
104-
str(path), native_namespace=native_namespace, **kwargs
105-
)
103+
nw.scan_parquet(str(path), backend=native_namespace, **kwargs)
106104
for path in data_paths
107105
)
108106
)

0 commit comments

Comments
 (0)