Skip to content

Commit b06e674

Browse files
committed
from '.to_native()' to '.native'
1 parent 940a6e8 commit b06e674

File tree

5 files changed

+8
-8
lines changed

5 files changed

+8
-8
lines changed

Diff for: narwhals/dataframe.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2912,7 +2912,7 @@ def collect(self) -> DataFrame[Any]:
29122912
| Use `.to_native` to see native output |
29132913
└───────────────────────────────────────┘
29142914
>>> df = lf.group_by("a").agg(nw.all().sum()).collect()
2915-
>>> df.to_native().sort("a")
2915+
>>> df.native.sort("a")
29162916
shape: (3, 3)
29172917
┌─────┬─────┬─────┐
29182918
│ a ┆ b ┆ c │

Diff for: narwhals/stable/v1/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,7 @@ def collect(self) -> DataFrame[Any]:
416416
| Use `.to_native` to see native output |
417417
└───────────────────────────────────────┘
418418
>>> df = lf.group_by("a").agg(nw.all().sum()).collect()
419-
>>> df.to_native().sort("a") # doctest:+SKIP
419+
>>> df.native.sort("a")
420420
shape: (3, 3)
421421
┌─────┬─────┬─────┐
422422
│ a ┆ b ┆ c │

Diff for: tests/from_pycapsule_test.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
def test_from_arrow_to_arrow() -> None:
1717
df = nw.from_native(pl.DataFrame({"ab": [1, 2, 3], "ba": [4, 5, 6]}), eager_only=True)
1818
result = nw.from_arrow(df, native_namespace=pa)
19-
assert isinstance(result.to_native(), pa.Table)
19+
assert isinstance(result.native, pa.Table)
2020
expected = {"ab": [1, 2, 3], "ba": [4, 5, 6]}
2121
assert_equal_data(result, expected)
2222

@@ -27,7 +27,7 @@ def test_from_arrow_to_polars(monkeypatch: pytest.MonkeyPatch) -> None:
2727
monkeypatch.delitem(sys.modules, "pandas")
2828
df = nw.from_native(tbl, eager_only=True)
2929
result = nw.from_arrow(df, native_namespace=pl)
30-
assert isinstance(result.to_native(), pl.DataFrame)
30+
assert isinstance(result.native, pl.DataFrame)
3131
expected = {"ab": [1, 2, 3], "ba": [4, 5, 6]}
3232
assert_equal_data(result, expected)
3333
assert "pandas" not in sys.modules
@@ -37,7 +37,7 @@ def test_from_arrow_to_polars(monkeypatch: pytest.MonkeyPatch) -> None:
3737
def test_from_arrow_to_pandas() -> None:
3838
df = nw.from_native(pa.table({"ab": [1, 2, 3], "ba": [4, 5, 6]}), eager_only=True)
3939
result = nw.from_arrow(df, native_namespace=pd)
40-
assert isinstance(result.to_native(), pd.DataFrame)
40+
assert isinstance(result.native, pd.DataFrame)
4141
expected = {"ab": [1, 2, 3], "ba": [4, 5, 6]}
4242
assert_equal_data(result, expected)
4343

Diff for: tests/stable_api_test.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def test_renamed_taxicab_norm_dataframe(constructor: Constructor) -> None:
4949
def func(df_any: Any) -> Any:
5050
df = nw_v1.from_native(df_any)
5151
df = df._l1_norm()
52-
return df.to_native()
52+
return df.native
5353

5454
result = nw_v1.from_native(func(constructor({"a": [1, 2, 3, -4, 5]})))
5555
expected = {"a": [15]}

Diff for: tests/utils_test.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ def test_maybe_reset_index_pandas() -> None:
102102
result = nw.maybe_reset_index(pandas_df)
103103
expected = pd.DataFrame({"a": [1, 2, 3], "b": [4, 5, 6]})
104104
assert_frame_equal(nw.to_native(result), expected)
105-
assert result.to_native() is pandas_df.to_native()
105+
assert result.native is pandas_df.native
106106
pandas_series = nw.from_native(
107107
pd.Series([1, 2, 3], index=[7, 8, 9]), series_only=True
108108
)
@@ -113,7 +113,7 @@ def test_maybe_reset_index_pandas() -> None:
113113
result_s = nw.maybe_reset_index(pandas_series)
114114
expected_s = pd.Series([1, 2, 3])
115115
assert_series_equal(nw.to_native(result_s), expected_s)
116-
assert result_s.to_native() is pandas_series.to_native()
116+
assert result_s.native is pandas_series.native
117117

118118

119119
def test_maybe_reset_index_polars() -> None:

0 commit comments

Comments
 (0)