ddf.hvplot.line with datashade=True throws AttributeError: 'tuple' object has no attribute 'iloc' in the datashader dask library
Closed this issue · 3 comments
N4321D commented
Example:
import dask.dataframe as dd
import pandas as pd
import numpy as np
import hvplot.dask
ddf = pd.from_pandas(pd.DataFrame({"a": np.random.random(100000)}), n_partitions=4)
ddf.a.hvplot.line(datashade=True)
throws this error:
WARNING:param.dynamic_operation: Callable raised "AttributeError("'tuple' object has no attribute 'iloc'")".
Invoked as dynamic_operation(height=300, scale=1.0, width=700, x_range=None, y_range=None)
WARNING:param.dynamic_operation: Callable raised "AttributeError("'tuple' object has no attribute 'iloc'")".
Invoked as dynamic_operation(height=300, scale=1.0, width=700, x_range=None, y_range=None)
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
File [/usr/local/lib/python3.12/site-packages/IPython/core/formatters.py:977](http://127.0.0.1:8888/usr/local/lib/python3.12/site-packages/IPython/core/formatters.py#line=976), in MimeBundleFormatter.__call__(self, obj, include, exclude)
974 method = get_real_method(obj, self.print_method)
976 if method is not None:
--> 977 return method(include=include, exclude=exclude)
978 return None
979 else:
File [/usr/local/lib/python3.12/site-packages/holoviews/core/dimension.py:1286](http://127.0.0.1:8888/usr/local/lib/python3.12/site-packages/holoviews/core/dimension.py#line=1285), in Dimensioned._repr_mimebundle_(self, include, exclude)
1279 def _repr_mimebundle_(self, include=None, exclude=None):
1280 """
1281 Resolves the class hierarchy for the class rendering the
1282 object using any display hooks registered on Store.display
1283 hooks. The output of all registered display_hooks is then
1284 combined and returned.
1285 """
-> 1286 return Store.render(self)
File [/usr/local/lib/python3.12/site-packages/holoviews/core/options.py:1428](http://127.0.0.1:8888/usr/local/lib/python3.12/site-packages/holoviews/core/options.py#line=1427), in Store.render(cls, obj)
1426 data, metadata = {}, {}
1427 for hook in hooks:
-> 1428 ret = hook(obj)
1429 if ret is None:
1430 continue
File [/usr/local/lib/python3.12/site-packages/holoviews/ipython/display_hooks.py:287](http://127.0.0.1:8888/usr/local/lib/python3.12/site-packages/holoviews/ipython/display_hooks.py#line=286), in pprint_display(obj)
285 if not ip.display_formatter.formatters['text[/plain](http://127.0.0.1:8888/plain)'].pprint:
286 return None
--> 287 return display(obj, raw_output=True)
File [/usr/local/lib/python3.12/site-packages/holoviews/ipython/display_hooks.py:261](http://127.0.0.1:8888/usr/local/lib/python3.12/site-packages/holoviews/ipython/display_hooks.py#line=260), in display(obj, raw_output, **kwargs)
259 elif isinstance(obj, (HoloMap, DynamicMap)):
260 with option_state(obj):
--> 261 output = map_display(obj)
262 elif isinstance(obj, Plot):
263 output = render(obj)
File [/usr/local/lib/python3.12/site-packages/holoviews/ipython/display_hooks.py:149](http://127.0.0.1:8888/usr/local/lib/python3.12/site-packages/holoviews/ipython/display_hooks.py#line=148), in display_hook.<locals>.wrapped(element)
147 try:
148 max_frames = OutputSettings.options['max_frames']
--> 149 mimebundle = fn(element, max_frames=max_frames)
150 if mimebundle is None:
151 return {}, {}
File [/usr/local/lib/python3.12/site-packages/holoviews/ipython/display_hooks.py:209](http://127.0.0.1:8888/usr/local/lib/python3.12/site-packages/holoviews/ipython/display_hooks.py#line=208), in map_display(vmap, max_frames)
206 max_frame_warning(max_frames)
207 return None
--> 209 return render(vmap)
File [/usr/local/lib/python3.12/site-packages/holoviews/ipython/display_hooks.py:76](http://127.0.0.1:8888/usr/local/lib/python3.12/site-packages/holoviews/ipython/display_hooks.py#line=75), in render(obj, **kwargs)
73 if renderer.fig == 'pdf':
74 renderer = renderer.instance(fig='png')
---> 76 return renderer.components(obj, **kwargs)
File [/usr/local/lib/python3.12/site-packages/holoviews/plotting/renderer.py:396](http://127.0.0.1:8888/usr/local/lib/python3.12/site-packages/holoviews/plotting/renderer.py#line=395), in Renderer.components(self, obj, fmt, comm, **kwargs)
393 embed = (not (dynamic or streams or self.widget_mode == 'live') or config.embed)
395 if embed or config.comms == 'default':
--> 396 return self._render_panel(plot, embed, comm)
397 return self._render_ipywidget(plot)
File [/usr/local/lib/python3.12/site-packages/holoviews/plotting/renderer.py:403](http://127.0.0.1:8888/usr/local/lib/python3.12/site-packages/holoviews/plotting/renderer.py#line=402), in Renderer._render_panel(self, plot, embed, comm)
401 doc = Document()
402 with config.set(embed=embed):
--> 403 model = plot.layout._render_model(doc, comm)
404 if embed:
405 return render_model(model, comm)
File [/usr/local/lib/python3.12/site-packages/panel/viewable.py:736](http://127.0.0.1:8888/usr/local/lib/python3.12/site-packages/panel/viewable.py#line=735), in Viewable._render_model(self, doc, comm)
734 if comm is None:
735 comm = state._comm_manager.get_server_comm()
--> 736 model = self.get_root(doc, comm)
738 if self._design and self._design.theme.bokeh_theme:
739 doc.theme = self._design.theme.bokeh_theme
File [/usr/local/lib/python3.12/site-packages/panel/layout/base.py:320](http://127.0.0.1:8888/usr/local/lib/python3.12/site-packages/panel/layout/base.py#line=319), in Panel.get_root(self, doc, comm, preprocess)
316 def get_root(
317 self, doc: Optional[Document] = None, comm: Optional[Comm] = None,
318 preprocess: bool = True
319 ) -> Model:
--> 320 root = super().get_root(doc, comm, preprocess)
321 # ALERT: Find a better way to handle this
322 if hasattr(root, 'styles') and 'overflow-x' in root.styles:
File [/usr/local/lib/python3.12/site-packages/panel/viewable.py:667](http://127.0.0.1:8888/usr/local/lib/python3.12/site-packages/panel/viewable.py#line=666), in Renderable.get_root(self, doc, comm, preprocess)
665 wrapper = self._design._wrapper(self)
666 if wrapper is self:
--> 667 root = self._get_model(doc, comm=comm)
668 if preprocess:
669 self._preprocess(root)
File [/usr/local/lib/python3.12/site-packages/panel/layout/base.py:186](http://127.0.0.1:8888/usr/local/lib/python3.12/site-packages/panel/layout/base.py#line=185), in Panel._get_model(self, doc, root, parent, comm)
184 root = root or model
185 self._models[root.ref['id']] = (model, parent)
--> 186 objects, _ = self._get_objects(model, [], doc, root, comm)
187 props = self._get_properties(doc)
188 props[self._property_mapping['objects']] = objects
File [/usr/local/lib/python3.12/site-packages/panel/layout/base.py:168](http://127.0.0.1:8888/usr/local/lib/python3.12/site-packages/panel/layout/base.py#line=167), in Panel._get_objects(self, model, old_objects, doc, root, comm)
166 else:
167 try:
--> 168 child = pane._get_model(doc, root, model, comm)
169 except RerenderError as e:
170 if e.layout is not None and e.layout is not self:
File [/usr/local/lib/python3.12/site-packages/panel/pane/holoviews.py:429](http://127.0.0.1:8888/usr/local/lib/python3.12/site-packages/panel/pane/holoviews.py#line=428), in HoloViews._get_model(self, doc, root, parent, comm)
427 plot = self.object
428 else:
--> 429 plot = self._render(doc, comm, root)
431 plot.pane = self
432 backend = plot.renderer.backend
File [/usr/local/lib/python3.12/site-packages/panel/pane/holoviews.py:525](http://127.0.0.1:8888/usr/local/lib/python3.12/site-packages/panel/pane/holoviews.py#line=524), in HoloViews._render(self, doc, comm, root)
522 if comm:
523 kwargs['comm'] = comm
--> 525 return renderer.get_plot(self.object, **kwargs)
File [/usr/local/lib/python3.12/site-packages/holoviews/plotting/bokeh/renderer.py:68](http://127.0.0.1:8888/usr/local/lib/python3.12/site-packages/holoviews/plotting/bokeh/renderer.py#line=67), in BokehRenderer.get_plot(self_or_cls, obj, doc, renderer, **kwargs)
61 @bothmethod
62 def get_plot(self_or_cls, obj, doc=None, renderer=None, **kwargs):
63 """
64 Given a HoloViews Viewable return a corresponding plot instance.
65 Allows supplying a document attach the plot to, useful when
66 combining the bokeh model with another plot.
67 """
---> 68 plot = super().get_plot(obj, doc, renderer, **kwargs)
69 if plot.document is None:
70 plot.document = Document() if self_or_cls.notebook_context else curdoc()
File [/usr/local/lib/python3.12/site-packages/holoviews/plotting/renderer.py:217](http://127.0.0.1:8888/usr/local/lib/python3.12/site-packages/holoviews/plotting/renderer.py#line=216), in Renderer.get_plot(self_or_cls, obj, doc, renderer, comm, **kwargs)
214 raise SkipRendering(msg.format(dims=dims))
216 # Initialize DynamicMaps with first data item
--> 217 initialize_dynamic(obj)
219 if not renderer:
220 renderer = self_or_cls
File [/usr/local/lib/python3.12/site-packages/holoviews/plotting/util.py:270](http://127.0.0.1:8888/usr/local/lib/python3.12/site-packages/holoviews/plotting/util.py#line=269), in initialize_dynamic(obj)
268 continue
269 if not len(dmap):
--> 270 dmap[dmap._initial_key()]
File [/usr/local/lib/python3.12/site-packages/holoviews/core/spaces.py:1217](http://127.0.0.1:8888/usr/local/lib/python3.12/site-packages/holoviews/core/spaces.py#line=1216), in DynamicMap.__getitem__(self, key)
1215 # Not a cross product and nothing cached so compute element.
1216 if cache is not None: return cache
-> 1217 val = self._execute_callback(*tuple_key)
1218 if data_slice:
1219 val = self._dataslice(val, data_slice)
File [/usr/local/lib/python3.12/site-packages/holoviews/core/spaces.py:984](http://127.0.0.1:8888/usr/local/lib/python3.12/site-packages/holoviews/core/spaces.py#line=983), in DynamicMap._execute_callback(self, *args)
981 kwargs['_memoization_hash_'] = hash_items
983 with dynamicmap_memoization(self.callback, self.streams):
--> 984 retval = self.callback(*args, **kwargs)
985 return self._style(retval)
File [/usr/local/lib/python3.12/site-packages/holoviews/core/spaces.py:582](http://127.0.0.1:8888/usr/local/lib/python3.12/site-packages/holoviews/core/spaces.py#line=581), in Callable.__call__(self, *args, **kwargs)
579 args, kwargs = (), dict(pos_kwargs, **kwargs)
581 try:
--> 582 ret = self.callable(*args, **kwargs)
583 except KeyError:
584 # KeyError is caught separately because it is used to signal
585 # invalid keys on DynamicMap and should not warn
586 raise
File [/usr/local/lib/python3.12/site-packages/holoviews/util/__init__.py:1037](http://127.0.0.1:8888/usr/local/lib/python3.12/site-packages/holoviews/util/__init__.py#line=1036), in Dynamic._dynamic_operation.<locals>.dynamic_operation(*key, **kwargs)
1036 def dynamic_operation(*key, **kwargs):
-> 1037 key, obj = resolve(key, kwargs)
1038 return apply(obj, *key, **kwargs)
File [/usr/local/lib/python3.12/site-packages/holoviews/util/__init__.py:1026](http://127.0.0.1:8888/usr/local/lib/python3.12/site-packages/holoviews/util/__init__.py#line=1025), in Dynamic._dynamic_operation.<locals>.resolve(key, kwargs)
1024 elif isinstance(map_obj, DynamicMap) and map_obj._posarg_keys and not key:
1025 key = tuple(kwargs[k] for k in map_obj._posarg_keys)
-> 1026 return key, map_obj[key]
File [/usr/local/lib/python3.12/site-packages/holoviews/core/spaces.py:1217](http://127.0.0.1:8888/usr/local/lib/python3.12/site-packages/holoviews/core/spaces.py#line=1216), in DynamicMap.__getitem__(self, key)
1215 # Not a cross product and nothing cached so compute element.
1216 if cache is not None: return cache
-> 1217 val = self._execute_callback(*tuple_key)
1218 if data_slice:
1219 val = self._dataslice(val, data_slice)
File [/usr/local/lib/python3.12/site-packages/holoviews/core/spaces.py:984](http://127.0.0.1:8888/usr/local/lib/python3.12/site-packages/holoviews/core/spaces.py#line=983), in DynamicMap._execute_callback(self, *args)
981 kwargs['_memoization_hash_'] = hash_items
983 with dynamicmap_memoization(self.callback, self.streams):
--> 984 retval = self.callback(*args, **kwargs)
985 return self._style(retval)
File [/usr/local/lib/python3.12/site-packages/holoviews/core/spaces.py:582](http://127.0.0.1:8888/usr/local/lib/python3.12/site-packages/holoviews/core/spaces.py#line=581), in Callable.__call__(self, *args, **kwargs)
579 args, kwargs = (), dict(pos_kwargs, **kwargs)
581 try:
--> 582 ret = self.callable(*args, **kwargs)
583 except KeyError:
584 # KeyError is caught separately because it is used to signal
585 # invalid keys on DynamicMap and should not warn
586 raise
File [/usr/local/lib/python3.12/site-packages/holoviews/util/__init__.py:1038](http://127.0.0.1:8888/usr/local/lib/python3.12/site-packages/holoviews/util/__init__.py#line=1037), in Dynamic._dynamic_operation.<locals>.dynamic_operation(*key, **kwargs)
1036 def dynamic_operation(*key, **kwargs):
1037 key, obj = resolve(key, kwargs)
-> 1038 return apply(obj, *key, **kwargs)
File [/usr/local/lib/python3.12/site-packages/holoviews/util/__init__.py:1030](http://127.0.0.1:8888/usr/local/lib/python3.12/site-packages/holoviews/util/__init__.py#line=1029), in Dynamic._dynamic_operation.<locals>.apply(element, *key, **kwargs)
1028 def apply(element, *key, **kwargs):
1029 kwargs = dict(util.resolve_dependent_kwargs(self.p.kwargs), **kwargs)
-> 1030 processed = self._process(element, key, kwargs)
1031 if (self.p.link_dataset and isinstance(element, Dataset) and
1032 isinstance(processed, Dataset) and processed._dataset is None):
1033 processed._dataset = element.dataset
File [/usr/local/lib/python3.12/site-packages/holoviews/util/__init__.py:1012](http://127.0.0.1:8888/usr/local/lib/python3.12/site-packages/holoviews/util/__init__.py#line=1011), in Dynamic._process(self, element, key, kwargs)
1010 elif isinstance(self.p.operation, Operation):
1011 kwargs = {k: v for k, v in kwargs.items() if k in self.p.operation.param}
-> 1012 return self.p.operation.process_element(element, key, **kwargs)
1013 else:
1014 return self.p.operation(element, **kwargs)
File [/usr/local/lib/python3.12/site-packages/holoviews/core/operation.py:194](http://127.0.0.1:8888/usr/local/lib/python3.12/site-packages/holoviews/core/operation.py#line=193), in Operation.process_element(self, element, key, **params)
191 else:
192 self.p = param.ParamOverrides(self, params,
193 allow_extra_keywords=self._allow_extra_keywords)
--> 194 return self._apply(element, key)
File [/usr/local/lib/python3.12/site-packages/holoviews/core/operation.py:141](http://127.0.0.1:8888/usr/local/lib/python3.12/site-packages/holoviews/core/operation.py#line=140), in Operation._apply(self, element, key)
139 if not in_method:
140 element._in_method = True
--> 141 ret = self._process(element, key)
142 if hasattr(element, '_in_method') and not in_method:
143 element._in_method = in_method
File [/usr/local/lib/python3.12/site-packages/holoviews/operation/datashader.py:1527](http://127.0.0.1:8888/usr/local/lib/python3.12/site-packages/holoviews/operation/datashader.py#line=1526), in datashade._process(self, element, key)
1526 def _process(self, element, key=None):
-> 1527 agg = rasterize._process(self, element, key)
1528 shaded = shade._process(self, agg, key)
1529 return shaded
File [/usr/local/lib/python3.12/site-packages/holoviews/operation/datashader.py:1506](http://127.0.0.1:8888/usr/local/lib/python3.12/site-packages/holoviews/operation/datashader.py#line=1505), in rasterize._process(self, element, key)
1503 op = transform.instance(**{k:v for k,v in extended_kws.items()
1504 if k in transform.param})
1505 op._precomputed = self._precomputed
-> 1506 element = element.map(op, predicate)
1507 self._precomputed = op._precomputed
1509 unused_params = list(all_supplied_kws - all_allowed_kws)
File [/usr/local/lib/python3.12/site-packages/holoviews/core/data/__init__.py:196](http://127.0.0.1:8888/usr/local/lib/python3.12/site-packages/holoviews/core/data/__init__.py#line=195), in PipelineMeta.pipelined.<locals>.pipelined_fn(*args, **kwargs)
193 inst._in_method = True
195 try:
--> 196 result = method_fn(*args, **kwargs)
197 if PipelineMeta.disable:
198 return result
File [/usr/local/lib/python3.12/site-packages/holoviews/core/data/__init__.py:1213](http://127.0.0.1:8888/usr/local/lib/python3.12/site-packages/holoviews/core/data/__init__.py#line=1212), in Dataset.map(self, *args, **kwargs)
1211 @wraps(LabelledData.map)
1212 def map(self, *args, **kwargs):
-> 1213 return super().map(*args, **kwargs)
File [/usr/local/lib/python3.12/site-packages/holoviews/core/dimension.py:697](http://127.0.0.1:8888/usr/local/lib/python3.12/site-packages/holoviews/core/dimension.py#line=696), in LabelledData.map(self, map_fn, specs, clone)
695 return deep_mapped
696 else:
--> 697 return map_fn(self) if applies else self
File [/usr/local/lib/python3.12/site-packages/holoviews/core/operation.py:214](http://127.0.0.1:8888/usr/local/lib/python3.12/site-packages/holoviews/core/operation.py#line=213), in Operation.__call__(self, element, **kwargs)
210 return element.clone([(k, self._apply(el, key=k))
211 for k, el in element.items()])
212 elif ((self._per_element and isinstance(element, Element)) or
213 (not self._per_element and isinstance(element, ViewableElement))):
--> 214 return self._apply(element)
215 elif 'streams' not in kwargs:
216 kwargs['streams'] = self.p.streams
File [/usr/local/lib/python3.12/site-packages/holoviews/core/operation.py:141](http://127.0.0.1:8888/usr/local/lib/python3.12/site-packages/holoviews/core/operation.py#line=140), in Operation._apply(self, element, key)
139 if not in_method:
140 element._in_method = True
--> 141 ret = self._process(element, key)
142 if hasattr(element, '_in_method') and not in_method:
143 element._in_method = in_method
File [/usr/local/lib/python3.12/site-packages/holoviews/operation/datashader.py:394](http://127.0.0.1:8888/usr/local/lib/python3.12/site-packages/holoviews/operation/datashader.py#line=393), in aggregate._process(self, element, key)
392 params["vdims"] = [*params["vdims"], *sel_vdims]
393 else:
--> 394 agg = self._apply_datashader(dfdata, cvs_fn, agg_fn, agg_kwargs, x, y)
396 if 'x_axis' in agg.coords and 'y_axis' in agg.coords:
397 agg = agg.rename({'x_axis': x, 'y_axis': y})
File [/usr/local/lib/python3.12/site-packages/holoviews/operation/datashader.py:419](http://127.0.0.1:8888/usr/local/lib/python3.12/site-packages/holoviews/operation/datashader.py#line=418), in aggregate._apply_datashader(self, dfdata, cvs_fn, agg_fn, agg_kwargs, x, y)
414 with warnings.catch_warnings():
415 warnings.filterwarnings(
416 action='ignore', message='casting datetime64',
417 category=FutureWarning
418 )
--> 419 agg = cvs_fn(dfdata, x.name, y.name, agg_fn, **agg_kwargs)
421 is_where_index = ds15 and isinstance(agg_fn, ds.where) and isinstance(agg_fn.column, rd.SpecialColumn)
422 is_summary_index = isinstance(agg_fn, ds.summary) and "index" in agg
File [/usr/local/lib/python3.12/site-packages/datashader/core.py:472](http://127.0.0.1:8888/usr/local/lib/python3.12/site-packages/datashader/core.py#line=471), in Canvas.line(self, source, x, y, agg, axis, geometry, line_width, antialias)
464 if not isinstance(non_cat_agg, (
465 rd.any, rd.count, rd.max, rd.min, rd.sum, rd.summary, rd._sum_zero,
466 rd._first_or_last, rd.mean, rd.max_n, rd.min_n, rd._first_n_or_last_n,
467 rd._max_or_min_row_index, rd._max_n_or_min_n_row_index, rd.where,
468 )):
469 raise NotImplementedError(
470 f"{type(non_cat_agg)} reduction not implemented for antialiased lines")
--> 472 return bypixel(source, self, glyph, agg, antialias=glyph.antialiased)
File [/usr/local/lib/python3.12/site-packages/datashader/core.py:1335](http://127.0.0.1:8888/usr/local/lib/python3.12/site-packages/datashader/core.py#line=1334), in bypixel(source, canvas, glyph, agg, antialias)
1333 with warnings.catch_warnings():
1334 warnings.filterwarnings('ignore', r'All-NaN (slice|axis) encountered')
-> 1335 return bypixel.pipeline(source, schema, canvas, glyph, agg, antialias=antialias)
File [/usr/local/lib/python3.12/site-packages/datashader/utils.py:114](http://127.0.0.1:8888/usr/local/lib/python3.12/site-packages/datashader/utils.py#line=113), in Dispatcher.__call__(self, head, *rest, **kwargs)
112 typ = type(head)
113 if typ in lk:
--> 114 return lk[typ](head, *rest, **kwargs)
115 for cls in getmro(typ)[1:]:
116 if cls in lk:
File [/usr/local/lib/python3.12/site-packages/datashader/data_libraries/dask.py:35](http://127.0.0.1:8888/usr/local/lib/python3.12/site-packages/datashader/data_libraries/dask.py#line=34), in dask_pipeline(df, schema, canvas, glyph, summary, antialias, cuda)
32 graph = df.__dask_graph__()
34 dsk.update(optimize(graph, keys))
---> 35 return scheduler(dsk, name)
File [/usr/local/lib/python3.12/site-packages/dask/threaded.py:90](http://127.0.0.1:8888/usr/local/lib/python3.12/site-packages/dask/threaded.py#line=89), in get(dsk, keys, cache, num_workers, pool, **kwargs)
87 elif isinstance(pool, multiprocessing.pool.Pool):
88 pool = MultiprocessingPoolExecutor(pool)
---> 90 results = get_async(
91 pool.submit,
92 pool._max_workers,
93 dsk,
94 keys,
95 cache=cache,
96 get_id=_thread_get_id,
97 pack_exception=pack_exception,
98 **kwargs,
99 )
101 # Cleanup pools associated to dead threads
102 with pools_lock:
File [/usr/local/lib/python3.12/site-packages/dask/local.py:512](http://127.0.0.1:8888/usr/local/lib/python3.12/site-packages/dask/local.py#line=511), in get_async(submit, num_workers, dsk, result, cache, get_id, rerun_exceptions_locally, pack_exception, raise_exception, callbacks, dumps, loads, chunksize, **kwargs)
510 _execute_task(task, data) # Re-execute locally
511 else:
--> 512 raise_exception(exc, tb)
513 res, worker_id = loads(res_info)
514 state["cache"][key] = res
File [/usr/local/lib/python3.12/site-packages/dask/local.py:320](http://127.0.0.1:8888/usr/local/lib/python3.12/site-packages/dask/local.py#line=319), in reraise(exc, tb)
318 if exc.__traceback__ is not tb:
319 raise exc.with_traceback(tb)
--> 320 raise exc
File [/usr/local/lib/python3.12/site-packages/dask/local.py:225](http://127.0.0.1:8888/usr/local/lib/python3.12/site-packages/dask/local.py#line=224), in execute_task(key, task_info, dumps, loads, get_id, pack_exception)
223 try:
224 task, data = loads(task_info)
--> 225 result = _execute_task(task, data)
226 id = get_id()
227 result = dumps((result, id))
File [/usr/local/lib/python3.12/site-packages/dask/core.py:127](http://127.0.0.1:8888/usr/local/lib/python3.12/site-packages/dask/core.py#line=126), in _execute_task(arg, cache, dsk)
123 func, args = arg[0], arg[1:]
124 # Note: Don't assign the subtask results to a variable. numpy detects
125 # temporaries by their reference count and can execute certain
126 # operations in-place.
--> 127 return func(*(_execute_task(a, cache) for a in args))
128 elif not ishashable(arg):
129 return arg
File [/usr/local/lib/python3.12/site-packages/datashader/data_libraries/dask.py:229](http://127.0.0.1:8888/usr/local/lib/python3.12/site-packages/datashader/data_libraries/dask.py#line=228), in line.<locals>.chunk(df, df2)
227 plot_start = True
228 if df2 is not None:
--> 229 df = concat([df.iloc[-1:], df2])
230 plot_start = False
231 aggs = create(shape)
AttributeError: 'tuple' object has no attribute 'iloc'
:DynamicMap []
VERSIONS:
OS: debian bookworm
pip list:
Package Version
------------------------- --------------
anyio 4.3.0
argon2-cffi 23.1.0
argon2-cffi-bindings 21.2.0
arrow 1.3.0
asciitree 0.3.3
asttokens 2.4.1
async-lru 2.0.4
attrs 23.2.0
Babel 2.15.0
beautifulsoup4 4.12.3
black 24.4.2
bleach 6.1.0
bokeh 3.4.1
certifi 2024.2.2
cffi 1.16.0
chardet 5.2.0
charset-normalizer 3.3.2
click 8.1.7
cloudpickle 3.0.0
colorama 0.4.6
colorcet 3.1.0
comm 0.2.2
contourpy 1.2.1
cycler 0.12.1
daal 2024.4.0
daal4py 2024.4.0
dask 2024.5.0
dask-expr 1.1.0
dask-glm 0.3.2
dask-ml 2024.4.4
datashader 0.16.1
debugpy 1.8.1
decorator 5.1.1
defusedxml 0.7.1
distributed 2024.5.0
executing 2.0.1
fasteners 0.19
fastjsonschema 2.19.1
fonttools 4.51.0
fqdn 1.5.1
fsspec 2024.3.1
geckodriver 0.0.1
gitdb 4.0.11
GitPython 3.1.43
h11 0.14.0
holoviews 1.18.3
httpcore 1.0.5
httpx 0.27.0
hvplot 0.10.0
idna 3.7
ipykernel 6.29.4
ipython 8.24.0
ipywidgets 8.1.2
isoduration 20.11.0
isort 5.13.2
jedi 0.19.1
Jinja2 3.1.4
joblib 1.4.2
json5 0.9.25
jsonpointer 2.4
jsonschema 4.22.0
jsonschema-specifications 2023.12.1
jupyter_bokeh 4.0.4
jupyter_client 8.6.1
jupyter_core 5.7.2
jupyter-events 0.10.0
jupyter-lsp 2.2.5
jupyter_server 2.14.0
jupyter-server-mathjax 0.2.6
jupyter_server_terminals 0.5.3
jupyterlab 4.2.0
jupyterlab_code_formatter 2.2.1
jupyterlab_darkside_theme 0.1.2
jupyterlab_git 0.50.0
jupyterlab_pygments 0.3.0
jupyterlab_server 2.27.1
jupyterlab_widgets 3.0.10
kiwisolver 1.4.5
linkify-it-py 2.0.3
llvmlite 0.42.0
locket 1.0.0
Markdown 3.6
markdown-it-py 3.0.0
MarkupSafe 2.1.5
matplotlib 3.8.4
matplotlib-inline 0.1.7
mdit-py-plugins 0.4.1
mdurl 0.1.2
mistune 3.0.2
msgpack 1.0.8
multipledispatch 1.0.0
mypy-extensions 1.0.0
nbclient 0.10.0
nbconvert 7.16.4
nbdime 4.0.1
nbformat 5.10.4
nest-asyncio 1.6.0
notebook_shim 0.2.4
numba 0.59.1
numcodecs 0.12.1
numpy 1.26.4
outcome 1.3.0.post0
overrides 7.7.0
packaging 24.0
pandas 2.2.2
pandas-flavor 0.6.0
pandocfilters 1.5.1
panel 1.4.2
param 2.1.0
parso 0.8.4
partd 1.4.2
pathspec 0.12.1
patsy 0.5.6
pexpect 4.9.0
pillow 10.3.0
pingouin 0.5.4
pip 24.0
platformdirs 4.2.1
plotly 5.22.0
prometheus_client 0.20.0
prompt-toolkit 3.0.43
psutil 5.9.8
ptyprocess 0.7.0
pure-eval 0.2.2
pyarrow 16.1.0
pycparser 2.22
pyct 0.5.0
pydot 2.0.0
Pygments 2.18.0
pyparsing 3.1.2
PySocks 1.7.1
python-dateutil 2.9.0.post0
python-json-logger 2.0.7
pytz 2024.1
pyviz_comms 3.0.2
PyYAML 6.0.1
pyzmq 26.0.3
referencing 0.35.1
requests 2.31.0
rfc3339-validator 0.1.4
rfc3986-validator 0.1.1
rpds-py 0.18.1
scikit-learn 1.4.2
scikit-learn-intelex 2024.4.0
scipy 1.13.0
seaborn 0.13.2
selenium 4.20.0
Send2Trash 1.8.3
setuptools 69.5.1
six 1.16.0
smmap 5.0.1
sniffio 1.3.1
sortedcontainers 2.4.0
soupsieve 2.5
sparse 0.15.1
stack-data 0.6.3
statsmodels 0.14.2
tabulate 0.9.0
tbb 2021.12.0
tblib 3.0.0
tenacity 8.3.0
terminado 0.18.1
threadpoolctl 3.5.0
tinycss2 1.3.0
toolz 0.12.1
tornado 6.4
tqdm 4.66.4
traitlets 5.14.3
trio 0.25.0
trio-websocket 0.11.1
types-python-dateutil 2.9.0.20240316
typing_extensions 4.11.0
tzdata 2024.1
uc-micro-py 1.0.3
uri-template 1.3.0
urllib3 2.2.1
wcwidth 0.2.13
webcolors 1.13
webencodings 0.5.1
websocket-client 1.8.0
wheel 0.43.0
widgetsnbextension 4.0.10
wsproto 1.2.0
xarray 2024.5.0
xyzservices 2024.4.0
zarr 2.18.0
hoxbro commented
This is related to dask_expr
being enabled by default. As a workaround, you can run dask config set dataframe.query-planning false
, which will restore the original behavior.
N4321D commented
thank you that worked
hoxbro commented
MRE in datashader:
import dask
import pandas as pd
import numpy as np
dask.config.set(**{"dataframe.query-planning": True})
import datashader as ds
import dask.dataframe as dd
ddf = dd.from_pandas(pd.DataFrame({"x": np.arange(100_000), "y": np.random.random(100000)}), npartitions=2)
cvs = ds.Canvas(plot_width=300, plot_height=300)
cvs.line(ddf.x.reset_index(), x='index', y='x')