Skip to content

Commit

Permalink
feat(base): add to_pandas method to BaseBackend
Browse files Browse the repository at this point in the history
It just wraps `execute` but I thought we should have it for consistency,
since it is present on expressions.
  • Loading branch information
gforsyth authored and cpcloud committed Dec 12, 2023
1 parent ee987b4 commit 3d1cf66
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions ibis/backends/base/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,34 @@ def _import_pyarrow():

return pyarrow

def to_pandas(
self,
expr: ir.Expr,
*,
params: Mapping[ir.Scalar, Any] | None = None,
limit: int | str | None = None,
**kwargs: Any,
) -> pd.DataFrame | pd.Series | Any:
"""Execute an Ibis expression and return a pandas `DataFrame`, `Series`, or scalar.
::: {.callout-note}
This method is a wrapper around `execute`.
:::
Parameters
----------
expr
Ibis expression to execute.
params
Mapping of scalar parameter expressions to value.
limit
An integer to effect a specific row limit. A value of `None` means
"no limit". The default is in `ibis/config.py`.
kwargs
Keyword arguments
"""
return self.execute(expr, params=params, limit=limit, **kwargs)

def to_pandas_batches(
self,
expr: ir.Expr,
Expand Down

0 comments on commit 3d1cf66

Please sign in to comment.