Skip to content

Commit 3d1cf66

Browse files
gforsythcpcloud
authored andcommitted
feat(base): add to_pandas method to BaseBackend
It just wraps `execute` but I thought we should have it for consistency, since it is present on expressions.
1 parent ee987b4 commit 3d1cf66

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

ibis/backends/base/__init__.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,34 @@ def _import_pyarrow():
249249

250250
return pyarrow
251251

252+
def to_pandas(
253+
self,
254+
expr: ir.Expr,
255+
*,
256+
params: Mapping[ir.Scalar, Any] | None = None,
257+
limit: int | str | None = None,
258+
**kwargs: Any,
259+
) -> pd.DataFrame | pd.Series | Any:
260+
"""Execute an Ibis expression and return a pandas `DataFrame`, `Series`, or scalar.
261+
262+
::: {.callout-note}
263+
This method is a wrapper around `execute`.
264+
:::
265+
266+
Parameters
267+
----------
268+
expr
269+
Ibis expression to execute.
270+
params
271+
Mapping of scalar parameter expressions to value.
272+
limit
273+
An integer to effect a specific row limit. A value of `None` means
274+
"no limit". The default is in `ibis/config.py`.
275+
kwargs
276+
Keyword arguments
277+
"""
278+
return self.execute(expr, params=params, limit=limit, **kwargs)
279+
252280
def to_pandas_batches(
253281
self,
254282
expr: ir.Expr,

0 commit comments

Comments
 (0)