Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename to_table to to_ibis #33

Merged
merged 1 commit into from
Mar 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions ibisml/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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"
Expand All @@ -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``.
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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"):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
Loading