Repository: holoviz/hvplot

Issue:
Ibis backend not working:  'list' object has no attribute 'name'
hvplot==0.8.2, duckdb=0.6.0, ibis-framework[duckdb]==3.2.0

I would like to try out combining duckdb and hvplot. It seems this should be possible via `ibis`. But when I try I get the below error.

```python
from pathlib import Path

import duckdb
import holoviews as hv
import ibis
import panel as pn
import wget

import hvplot.ibis

pn.extension(sizing_mode="stretch_width")

FILE = 'yellow_tripdata_2022-01.parquet'
PATH = Path(FILE)
URL = f"https://d37ci6vzurychx.cloudfront.net/trip-data/{FILE}"
DB = 'trip-data.duckdb'
TABLE = 'trip_data'

if not PATH.exists():
    wget.download(URL, FILE)
    con = duckdb.connect(database=DB, read_only=False)
    QUERY = f"CREATE TABLE {TABLE} AS SELECT * FROM read_parquet('{FILE}');"
    con.execute(QUERY)


con = ibis.duckdb.connect(database=DB, read_only=False)

trip_data = con.table(TABLE)
trip_data = trip_data.head(1000).sort_by("tpep_pickup_datetime")

plot = trip_data.hvplot(x="tpep_pickup_datetime", y="trip_distance")
```

```bash
$ python script.py
C:\repos\private\hvplot\.venv\lib\site-packages\ibis\backends\postgres\registry.py:164: UserWarning: locale specific date formats (%c, %x, %X) are not yet implemented for Windows
  warnings.warn(
C:\repos\private\hvplot\.venv\lib\site-packages\duckdb_engine\__init__.py:229: DuckDBEngineWarning: duckdb-engine doesn't yet support reflection on indices
  warnings.warn(
Traceback (most recent call last):
  File "C:\repos\private\hvplot\script.py", line 31, in <module>
    plot = trip_data.hvplot(x="tpep_pickup_datetime", y="trip_distance")
  File "C:\repos\private\hvplot\hvplot\plotting\core.py", line 92, in __call__
    return self._get_converter(x, y, kind, **kwds)(kind, x, y)
  File "C:\repos\private\hvplot\hvplot\plotting\core.py", line 99, in _get_converter
    return HoloViewsConverter(self._data, x, y, kind=kind, **params)
  File "C:\repos\private\hvplot\hvplot\converter.py", line 388, in __init__
    self._process_data(
  File "C:\repos\private\hvplot\hvplot\converter.py", line 854, in _process_data
    if hasattr(data, 'columns') and data.columns.name and not group_label:
AttributeError: 'list' object has no attribute 'name'
```


Discussion:

Resolving patch:
diff --git a/hvplot/converter.py b/hvplot/converter.py
--- a/hvplot/converter.py
+++ b/hvplot/converter.py
@@ -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'
diff --git a/hvplot/ibis.py b/hvplot/ibis.py
--- a/hvplot/ibis.py
+++ b/hvplot/ibis.py
@@ -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)


Test patch:
diff --git a/hvplot/tests/testibis.py b/hvplot/tests/testibis.py
new file mode 100644
--- /dev/null
+++ b/hvplot/tests/testibis.py
@@ -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")