Repository: holoviz/holoviews

Issue:
datashader doesn't seem to support datetime index
When trying to do a `datashader` plot on a dask dataframe with datetime index, I get the following:

`TypeError: Column assignment doesn't support type Array`

Simple reproducible example:
```python
import pandas as pd
import numpy as np
from dask import dataframe as dd
import holoviews as hv
from holoviews.operation.datashader import datashade
hv.extension('bokeh')

df = pd.DataFrame(
    data=np.random.randn(1000, 3), 
    columns=['a', 'b', 'c'],
    index=pd.date_range('2019-01-01', freq='1T', periods=1000),
)
ddf = dd.from_pandas(df, npartitions=4)

datashade(hv.Curve(ddf, kdims=['index'], vdims=['a', 'b']))
```


Discussion:

Resolving patch:
diff --git a/holoviews/operation/datashader.py b/holoviews/operation/datashader.py
--- a/holoviews/operation/datashader.py
+++ b/holoviews/operation/datashader.py
@@ -329,8 +329,8 @@ def get_agg_data(cls, obj, category=None):
             df = df.copy()
 
         for d in (x, y):
-            vals = df[d.name].values
-            if not is_dask and len(vals) and isinstance(vals[0], cftime_types):
+            vals = df[d.name]
+            if not is_dask and len(vals) and isinstance(vals.values[0], cftime_types):
                 vals = cftime_to_timestamp(vals, 'ns')
             elif df[d.name].dtype.kind == 'M':
                 vals = vals.astype('datetime64[ns]')


Test patch:
diff --git a/holoviews/tests/operation/testdatashader.py b/holoviews/tests/operation/testdatashader.py
--- a/holoviews/tests/operation/testdatashader.py
+++ b/holoviews/tests/operation/testdatashader.py
@@ -4,10 +4,11 @@
 from holoviews import (Dimension, Curve, Points, Image, Dataset, RGB, Path,
                        Graph, TriMesh, QuadMesh, NdOverlay, Contours)
 from holoviews.element.comparison import ComparisonTestCase
-from holoviews.core.util import pd
 
 try:
     import datashader as ds
+    import dask.dataframe as dd
+    from holoviews.core.util import pd
     from holoviews.operation.datashader import (
         aggregate, regrid, ds_version, stack, directly_connect_edges,
         shade, rasterize
@@ -93,6 +94,22 @@ def test_aggregate_curve_datetimes(self):
                          datatype=['xarray'], bounds=bounds, vdims='Count')
         self.assertEqual(img, expected)
 
+    def test_aggregate_curve_datetimes_dask(self):
+        df = pd.DataFrame(
+            data=np.arange(1000), columns=['a'],
+            index=pd.date_range('2019-01-01', freq='1T', periods=1000),
+        )
+        ddf = dd.from_pandas(df, npartitions=4)
+        curve = Curve(ddf, kdims=['index'], vdims=['a'])
+        img = aggregate(curve, width=2, height=3, dynamic=False)
+        bounds = (np.datetime64('2019-01-01T00:00:00.000000'), 0.0,
+                  np.datetime64('2019-01-01T16:39:00.000000'), 999.0)
+        dates = [np.datetime64('2019-01-01T04:09:45.000000000'),
+                 np.datetime64('2019-01-01T12:29:15.000000000')]
+        expected = Image((dates, [166.5, 499.5, 832.5], [[333, 0], [167, 166], [0, 334]]),
+                         ['index', 'a'], 'Count', datatype=['xarray'], bounds=bounds)
+        self.assertEqual(img, expected)
+
     def test_aggregate_curve_datetimes_microsecond_timebase(self):
         dates = pd.date_range(start="2016-01-01", end="2016-01-03", freq='1D')
         xstart = np.datetime64('2015-12-31T23:59:59.723518000', 'us')