From 8924cc2f07a36def424ea90434e4b6a18ed4680d Mon Sep 17 00:00:00 2001 From: Jim Crist-Harif Date: Wed, 20 Mar 2024 10:48:32 -0500 Subject: [PATCH] Rename `to_table` to `to_ibis` This better matches the other `to_*` method conventions. --- ibisml/core.py | 14 +++++++------- tests/test_core.py | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/ibisml/core.py b/ibisml/core.py index b060d37..6b6f966 100644 --- a/ibisml/core.py +++ b/ibisml/core.py @@ -366,7 +366,7 @@ def _categorize_pyarrow_batches( _categorize_wrap_reader(reader, self.metadata_.categories), ) - def to_table(self, X) -> ir.Table: + def to_ibis(self, X) -> ir.Table: """Transform X and return an ibis table. Parameters @@ -394,7 +394,7 @@ def to_pandas(self, X: Any, categories: bool = False) -> pd.DataFrame: as numeric columns containing only their integral categorical codes. """ - df = self.to_table(X).to_pandas() + df = self.to_ibis(X).to_pandas() if categories: return self._categorize_pandas(df) return df @@ -407,7 +407,7 @@ def to_numpy(self, X: Any) -> np.ndarray: X : table-like The input data to transform. """ - table = self.to_table(X) + table = self.to_ibis(X) if not all(t.is_numeric() for t in table.schema().types): raise ValueError( "Not all output columns are numeric, cannot convert to a numpy array" @@ -422,7 +422,7 @@ def to_polars(self, X: Any) -> pl.DataFrame: X : table-like The input data to transform. """ - return self.to_table(X).to_polars() + return self.to_ibis(X).to_polars() def to_pyarrow(self, X: Any, categories: bool = False) -> pa.Table: """Transform X and return a ``pyarrow.Table``. @@ -437,7 +437,7 @@ def to_pyarrow(self, X: Any, categories: bool = False) -> pa.Table: as numeric columns containing only their integral categorical codes. """ - table = self.to_table(X).to_pyarrow() + table = self.to_ibis(X).to_pyarrow() if categories: table = self._categorize_pyarrow(table) return table @@ -457,7 +457,7 @@ def to_pyarrow_batches( as numeric columns containing only their integral categorical codes. """ - reader = self.to_table(X).to_pyarrow_batches() + reader = self.to_ibis(X).to_pyarrow_batches() if categories: return self._categorize_pyarrow_batches(reader) return reader @@ -477,7 +477,7 @@ def to_dask_dataframe(self, X: Any, categories: bool = False) -> dd.DataFrame: """ import dask.dataframe as dd - table = self.to_table(X) + table = self.to_ibis(X) con = ibis.get_backend(table) if hasattr(con, "to_dask"): diff --git a/tests/test_core.py b/tests/test_core.py index 09c07b9..9caed4b 100644 --- a/tests/test_core.py +++ b/tests/test_core.py @@ -51,7 +51,7 @@ def test_sklearn_clone(table): assert not r2.is_fitted() r2.fit(table) - assert r1.to_table(table).equals(r2.to_table(table)) + assert r1.to_ibis(table).equals(r2.to_ibis(table)) def test_in_memory_workflow(df):