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

fix .hvplot for ibis #990

Merged
merged 2 commits into from
Dec 1, 2022
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
2 changes: 1 addition & 1 deletion hvplot/converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -851,7 +851,7 @@ def _process_data(self, kind, data, x, y, by, groupby, row, col,
'e.g. a NumPy array or xarray Dataset, '
'found %s type' % (kind, type(self.data).__name__))

if hasattr(data, 'columns') and data.columns.name and not group_label:
if hasattr(data, 'columns') and hasattr(data.columns, 'name') and data.columns.name and not group_label:
group_label = data.columns.name
elif not group_label:
group_label = 'Variable'
Expand Down
4 changes: 2 additions & 2 deletions hvplot/ibis.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ def patch(name='hvplot', extension='bokeh', logo=False):
try:
import ibis
except:
raise ImportError('Could not patch plotting API onto dask. '
'Dask could not be imported.')
raise ImportError('Could not patch plotting API onto ibis. '
'Ibis could not be imported.')
_patch_plot = lambda self: hvPlotTabular(self)
_patch_plot.__doc__ = hvPlotTabular.__call__.__doc__
patch_property = property(_patch_plot)
Expand Down
22 changes: 22 additions & 0 deletions hvplot/tests/testibis.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
"""Ibis works with hvplot"""
import pytest

try:
import ibis
import hvplot.ibis # noqa
import pandas as pd
except:
pytest.skip(allow_module_level=True)


@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")