diff --git a/hvplot/converter.py b/hvplot/converter.py index bf13c0689..354768d43 100644 --- a/hvplot/converter.py +++ b/hvplot/converter.py @@ -1860,6 +1860,8 @@ def hist(self, x=None, y=None, data=None): ymin, ymax = (ys.min(), ys.max()) if is_dask(ys): ymin, ymax = ymin.compute(), ymax.compute() + elif is_ibis(ys): + ymin, ymax = ymin.execute(), ymax.execute() hist_opts['bin_range'] = ymin, ymax ds = Dataset(data, self.by) @@ -1883,6 +1885,8 @@ def hist(self, x=None, y=None, data=None): ymin, ymax = (ys.min(), ys.max()) if is_dask(ys): ymin, ymax = ymin.compute(), ymax.compute() + elif is_ibis(ys): + ymin, ymax = ymin.execute(), ymax.execute() ranges.append((ymin, ymax)) if ranges: hist_opts['bin_range'] = max_range(ranges) diff --git a/hvplot/ibis.py b/hvplot/ibis.py index 0717ff0b7..7cd3f2516 100644 --- a/hvplot/ibis.py +++ b/hvplot/ibis.py @@ -1,3 +1,7 @@ +""" +Experimental support for ibis. +""" + def patch(name='hvplot', extension='bokeh', logo=False): from . import hvPlotTabular, post_patch diff --git a/hvplot/tests/testibis.py b/hvplot/tests/testibis.py index 5ad5757c7..2b2ed8b99 100644 --- a/hvplot/tests/testibis.py +++ b/hvplot/tests/testibis.py @@ -1,22 +1,19 @@ -"""Ibis works with hvplot""" +"""Basic ibis tests""" + +import numpy as np +import pandas as pd import pytest try: + import hvplot.ibis # noqa import ibis - import hvplot.ibis # noqa - import pandas as pd -except: +except ImportError: pytest.skip(allow_module_level=True) +else: + ibis.set_backend('sqlite') -@pytest.fixture -def table(): - df = pd.DataFrame({ - "x": [pd.Timestamp("2022-01-01"), pd.Timestamp("2022-01-02")], "y": [1,2] - }) - con = ibis.pandas.connect({"df": df}) - return con.table("df") - -def test_can_hvplot(table): - """hvplot works with Ibis""" - table.hvplot(x="x", y="y") +def test_ibis_hist(): + df = pd.DataFrame(dict(x=np.arange(10))) + table = ibis.memtable(df) + table.hvplot.hist('x') diff --git a/setup.cfg b/setup.cfg index 489f85a1b..1c7abd0d8 100644 --- a/setup.cfg +++ b/setup.cfg @@ -5,3 +5,4 @@ license_file = LICENSE [tool:pyctdev.conda] namespace_map = geoviews=geoviews-core + ibis-framework=ibis-sqlite diff --git a/setup.py b/setup.py index 06cd312ca..1d57c0b11 100644 --- a/setup.py +++ b/setup.py @@ -63,6 +63,7 @@ def get_setup_version(reponame): 'dask', 'polars', 'fugue', + 'ibis-framework', # ibis-sqlite on conda ] # Dependencies required to run the notebooks