Holoviews "Points" 使用 Datashader 但 "Curve" 抛出错误

Holoviews "Points" working with Datashader but "Curve" is throwing an error

我在 Jupyter Notebook 的 Python 中处理大数据(约 2500 万点),并希望拥有一个不会永远加载的交互式图表。使用 Bokeh 为我提供了交互性,Holoviews 和 Datashader 允许相对快速地绘制数据图。

Python: 3.7.6
散景:1.4.0
全息视图:1.14.3
麻木的:1.19.5
Pandas: 1.0.1
数巴:0.48.0

我没问题运行这个例子代码:

import numpy as np, pandas as pd, holoviews as hv
from holoviews.operation.datashader import datashade
hv.extension('bokeh','matplotlib')

n = 100000
dates = pd.date_range(start='1990-01-01', freq='1T', periods=n)
point = hv.Points((dates,
                  np.random.normal(size=(n,))))
datashade(point, cmap=['red']).opts(width=800)

这给出了一个很好的图表:

但是当我将 Holoviews 选项从“点”切换到“曲线”(这是原始代码)时,如下所示:

import numpy as np, pandas as pd, holoviews as hv
from holoviews.operation.datashader import datashade
hv.extension('bokeh','matplotlib')

n = 100000
dates = pd.date_range(start='1990-01-01', freq='1T', periods=n)
curve = hv.Curve((dates,
                  np.random.normal(size=(n,))))
datashade(curve, cmap=['red']).opts(width=800)

我收到这么长的错误:

WARNING:param.dynamic_operation: Callable raised "TypingError('Failed in nopython mode pipeline (step: nopython frontend)\n\x1b[1m\x1b[1m\x1b[1m\x1b[1mFailed in nopython mode pipeline (step: nopython frontend)\n\x1b[1m\x1b[1m\x1b[1m\x1b[1mFailed in nopython mode pipeline (step: nopython frontend)\n\x1b[1m\x1b[1m\x1b[1m\x1b[1mFailed in nopython mode pipeline (step: nopython frontend)\nInternal error at <numba.typeinfer.StaticGetItemConstraint object at 0x0000021D40ACEC88>.\n\x1b[1m\x1b[1mtuple index out of range\x1b[0m\n\x1b[0m\x1b[1m[1] During: typing of static-get-item at C:\Users\HornLab\Anaconda3\lib\site-packages\datashader\glyphs\line.py (653)\x1b[0m\nEnable logging at debug level for details.\n\x1b[1m\nFile "..\..\..\Anaconda3\lib\site-packages\datashader\glyphs\line.py", line 653:\x1b[0m\n\x1b[1mdef _xiaolinwu(i, x0, x1, y0, y1, append, *aggs_and_cols):\n    <source elided>\n    agg = aggs_and_cols[0]\n\x1b[1m    cols = aggs_and_cols[1]\n\x1b[0m    \x1b[1m^\x1b[0m\x1b[0m\n\n\x1b[0m\x1b[1m[1] During: resolving callee type: type(CPUDispatcher(<function _xiaolinwu at 0x0000021D2E0B98B8>))\x1b[0m\n\x1b[0m\x1b[1m[2] During: typing of call at <draw_segment> (33)\n\x1b[0m\n\x1b[0m\x1b[1m[3] During: resolving callee type: type(CPUDispatcher(<function _xiaolinwu at 0x0000021D2E0B98B8>))\x1b[0m\n\x1b[0m\x1b[1m[4] During: typing of call at <draw_segment> (33)\n\x1b[0m\n\x1b[1m\nFile "<draw_segment>", line 33:\x1b[0m\n\x1b[1m<source missing, REPL/exec in use?>\x1b[0m\n\n\x1b[0m\x1b[1m[1] During: resolving callee type: type(CPUDispatcher(<function draw_segment at 0x0000021D4063DAF8>))\x1b[0m\n\x1b[0m\x1b[1m[2] During: typing of call at <perform_extend_line> (13)\n\x1b[0m\n\x1b[0m\x1b[1m[3] During: resolving callee type: type(CPUDispatcher(<function draw_segment at 0x0000021D4063DAF8>))\x1b[0m\n\x1b[0m\x1b[1m[4] During: typing of call at <perform_extend_line> (13)\n\x1b[0m\n\x1b[1m\nFile "<perform_extend_line>", line 13:\x1b[0m\n\x1b[1m<source missing, REPL/exec in use?>\x1b[0m\n\n\x1b[0m\x1b[1m[1] During: resolving callee type: type(CPUDispatcher(<function perform_extend_line at 0x0000021D4063DE58>))\x1b[0m\n\x1b[0m\x1b[1m[2] During: typing of call at <extend_cpu> (10)\n\x1b[0m\n\x1b[0m\x1b[1m[3] During: resolving callee type: type(CPUDispatcher(<function perform_extend_line at 0x0000021D4063DE58>))\x1b[0m\n\x1b[0m\x1b[1m[4] During: typing of call at <extend_cpu> (10)\n\x1b[0m\n\x1b[1m\nFile "<extend_cpu>", line 10:\x1b[0m\n\x1b[1m<source missing, REPL/exec in use?>\x1b[0m\n')".
Invoked as dynamic_operation(height=400, scale=1.0, width=400, x_range=None, y_range=None)
WARNING:param.dynamic_operation: Callable raised "TypingError('Failed in nopython mode pipeline (step: nopython frontend)\n\x1b[1m\x1b[1m\x1b[1m\x1b[1mFailed in nopython mode pipeline (step: nopython frontend)\n\x1b[1m\x1b[1m\x1b[1m\x1b[1mFailed in nopython mode pipeline (step: nopython frontend)\n\x1b[1m\x1b[1m\x1b[1m\x1b[1mFailed in nopython mode pipeline (step: nopython frontend)\nInternal error at <numba.typeinfer.StaticGetItemConstraint object at 0x0000021D40ACEC88>.\n\x1b[1m\x1b[1mtuple index out of range\x1b[0m\n\x1b[0m\x1b[1m[1] During: typing of static-get-item at C:\Users\HornLab\Anaconda3\lib\site-packages\datashader\glyphs\line.py (653)\x1b[0m\nEnable logging at debug level for details.\n\x1b[1m\nFile "..\..\..\Anaconda3\lib\site-packages\datashader\glyphs\line.py", line 653:\x1b[0m\n\x1b[1mdef _xiaolinwu(i, x0, x1, y0, y1, append, *aggs_and_cols):\n    <source elided>\n    agg = aggs_and_cols[0]\n\x1b[1m    cols = aggs_and_cols[1]\n\x1b[0m    \x1b[1m^\x1b[0m\x1b[0m\n\n\x1b[0m\x1b[1m[1] During: resolving callee type: type(CPUDispatcher(<function _xiaolinwu at 0x0000021D2E0B98B8>))\x1b[0m\n\x1b[0m\x1b[1m[2] During: typing of call at <draw_segment> (33)\n\x1b[0m\n\x1b[0m\x1b[1m[3] During: resolving callee type: type(CPUDispatcher(<function _xiaolinwu at 0x0000021D2E0B98B8>))\x1b[0m\n\x1b[0m\x1b[1m[4] During: typing of call at <draw_segment> (33)\n\x1b[0m\n\x1b[1m\nFile "<draw_segment>", line 33:\x1b[0m\n\x1b[1m<source missing, REPL/exec in use?>\x1b[0m\n\n\x1b[0m\x1b[1m[1] During: resolving callee type: type(CPUDispatcher(<function draw_segment at 0x0000021D4063DAF8>))\x1b[0m\n\x1b[0m\x1b[1m[2] During: typing of call at <perform_extend_line> (13)\n\x1b[0m\n\x1b[0m\x1b[1m[3] During: resolving callee type: type(CPUDispatcher(<function draw_segment at 0x0000021D4063DAF8>))\x1b[0m\n\x1b[0m\x1b[1m[4] During: typing of call at <perform_extend_line> (13)\n\x1b[0m\n\x1b[1m\nFile "<perform_extend_line>", line 13:\x1b[0m\n\x1b[1m<source missing, REPL/exec in use?>\x1b[0m\n\n\x1b[0m\x1b[1m[1] During: resolving callee type: type(CPUDispatcher(<function perform_extend_line at 0x0000021D4063DE58>))\x1b[0m\n\x1b[0m\x1b[1m[2] During: typing of call at <extend_cpu> (10)\n\x1b[0m\n\x1b[0m\x1b[1m[3] During: resolving callee type: type(CPUDispatcher(<function perform_extend_line at 0x0000021D4063DE58>))\x1b[0m\n\x1b[0m\x1b[1m[4] During: typing of call at <extend_cpu> (10)\n\x1b[0m\n\x1b[1m\nFile "<extend_cpu>", line 10:\x1b[0m\n\x1b[1m<source missing, REPL/exec in use?>\x1b[0m\n')".
Invoked as dynamic_operation(height=400, scale=1.0, width=400, x_range=None, y_range=None)
---------------------------------------------------------------------------
TypingError                               Traceback (most recent call last)
~\Anaconda3\lib\site-packages\IPython\core\formatters.py in __call__(self, obj, include, exclude)
    968 
    969             if method is not None:
--> 970                 return method(include=include, exclude=exclude)
    971             return None
    972         else:

~\Anaconda3\lib\site-packages\holoviews\core\dimension.py in _repr_mimebundle_(self, include, exclude)
   1315         combined and returned.
   1316         """
-> 1317         return Store.render(self)
   1318 
   1319 

~\Anaconda3\lib\site-packages\holoviews\core\options.py in render(cls, obj)
   1403         data, metadata = {}, {}
   1404         for hook in hooks:
-> 1405             ret = hook(obj)
   1406             if ret is None:
   1407                 continue

~\Anaconda3\lib\site-packages\holoviews\ipython\display_hooks.py in pprint_display(obj)
    280     if not ip.display_formatter.formatters['text/plain'].pprint:
    281         return None
--> 282     return display(obj, raw_output=True)
    283 
    284 

~\Anaconda3\lib\site-packages\holoviews\ipython\display_hooks.py in display(obj, raw_output, **kwargs)
    256     elif isinstance(obj, (HoloMap, DynamicMap)):
    257         with option_state(obj):
--> 258             output = map_display(obj)
    259     elif isinstance(obj, Plot):
    260         output = render(obj)

~\Anaconda3\lib\site-packages\holoviews\ipython\display_hooks.py in wrapped(element)
    144         try:
    145             max_frames = OutputSettings.options['max_frames']
--> 146             mimebundle = fn(element, max_frames=max_frames)
    147             if mimebundle is None:
    148                 return {}, {}

~\Anaconda3\lib\site-packages\holoviews\ipython\display_hooks.py in map_display(vmap, max_frames)
    204         return None
    205 
--> 206     return render(vmap)
    207 
    208 

~\Anaconda3\lib\site-packages\holoviews\ipython\display_hooks.py in render(obj, **kwargs)
     66         renderer = renderer.instance(fig='png')
     67 
---> 68     return renderer.components(obj, **kwargs)
     69 
     70 

~\Anaconda3\lib\site-packages\holoviews\plotting\renderer.py in components(self, obj, fmt, comm, **kwargs)
    408                 doc = Document()
    409                 with config.set(embed=embed):
--> 410                     model = plot.layout._render_model(doc, comm)
    411                 if embed:
    412                     return render_model(model, comm)

~\Anaconda3\lib\site-packages\panel\viewable.py in _render_model(self, doc, comm)
    425         if comm is None:
    426             comm = state._comm_manager.get_server_comm()
--> 427         model = self.get_root(doc, comm)
    428 
    429         if config.embed:

~\Anaconda3\lib\site-packages\panel\viewable.py in get_root(self, doc, comm, preprocess)
    482        
    483         doc = init_doc(doc)
--> 484         root = self._get_model(doc, comm=comm)
    485         if preprocess:
    486             self._preprocess(root)

~\Anaconda3\lib\site-packages\panel\layout\base.py in _get_model(self, doc, root, parent, comm)
    111         if root is None:
    112             root = model
--> 113         objects = self._get_objects(model, [], doc, root, comm)
    114         props = dict(self._init_params(), objects=objects)
    115         model.update(**self._process_param_change(props))

~\Anaconda3\lib\site-packages\panel\layout\base.py in _get_objects(self, model, old_objects, doc, root, comm)
    101             else:
    102                 try:
--> 103                     child = pane._get_model(doc, root, model, comm)
    104                 except RerenderError:
    105                     return self._get_objects(model, current_objects[:i], doc, root, comm)

~\Anaconda3\lib\site-packages\panel\pane\holoviews.py in _get_model(self, doc, root, parent, comm)
    237             plot = self.object
    238         else:
--> 239             plot = self._render(doc, comm, root)
    240 
    241         plot.pane = self

~\Anaconda3\lib\site-packages\panel\pane\holoviews.py in _render(self, doc, comm, root)
    302                 kwargs['comm'] = comm
    303 
--> 304         return renderer.get_plot(self.object, **kwargs)
    305 
    306     def _cleanup(self, root):

~\Anaconda3\lib\site-packages\holoviews\plotting\bokeh\renderer.py in get_plot(self_or_cls, obj, doc, renderer, **kwargs)
     71         combining the bokeh model with another plot.
     72         """
---> 73         plot = super(BokehRenderer, self_or_cls).get_plot(obj, doc, renderer, **kwargs)
     74         if plot.document is None:
     75             plot.document = Document() if self_or_cls.notebook_context else curdoc()

~\Anaconda3\lib\site-packages\holoviews\plotting\renderer.py in get_plot(self_or_cls, obj, doc, renderer, comm, **kwargs)
    218 
    219         # Initialize DynamicMaps with first data item
--> 220         initialize_dynamic(obj)
    221 
    222         if not renderer:

~\Anaconda3\lib\site-packages\holoviews\plotting\util.py in initialize_dynamic(obj)
    250             continue
    251         if not len(dmap):
--> 252             dmap[dmap._initial_key()]
    253 
    254 

~\Anaconda3\lib\site-packages\holoviews\core\spaces.py in __getitem__(self, key)
   1339         # Not a cross product and nothing cached so compute element.
   1340         if cache is not None: return cache
-> 1341         val = self._execute_callback(*tuple_key)
   1342         if data_slice:
   1343             val = self._dataslice(val, data_slice)

~\Anaconda3\lib\site-packages\holoviews\core\spaces.py in _execute_callback(self, *args)
   1108 
   1109         with dynamicmap_memoization(self.callback, self.streams):
-> 1110             retval = self.callback(*args, **kwargs)
   1111         return self._style(retval)
   1112 

~\Anaconda3\lib\site-packages\holoviews\core\spaces.py in __call__(self, *args, **kwargs)
    712 
    713         try:
--> 714             ret = self.callable(*args, **kwargs)
    715         except KeyError:
    716             # KeyError is caught separately because it is used to signal

~\Anaconda3\lib\site-packages\holoviews\util\__init__.py in dynamic_operation(*key, **kwargs)
   1040 
   1041         def dynamic_operation(*key, **kwargs):
-> 1042             key, obj = resolve(key, kwargs)
   1043             return apply(obj, *key, **kwargs)
   1044 

~\Anaconda3\lib\site-packages\holoviews\util\__init__.py in resolve(key, kwargs)
   1029             elif isinstance(map_obj, DynamicMap) and map_obj._posarg_keys and not key:
   1030                 key = tuple(kwargs[k] for k in map_obj._posarg_keys)
-> 1031             return key, map_obj[key]
   1032 
   1033         def apply(element, *key, **kwargs):

~\Anaconda3\lib\site-packages\holoviews\core\spaces.py in __getitem__(self, key)
   1339         # Not a cross product and nothing cached so compute element.
   1340         if cache is not None: return cache
-> 1341         val = self._execute_callback(*tuple_key)
   1342         if data_slice:
   1343             val = self._dataslice(val, data_slice)

~\Anaconda3\lib\site-packages\holoviews\core\spaces.py in _execute_callback(self, *args)
   1108 
   1109         with dynamicmap_memoization(self.callback, self.streams):
-> 1110             retval = self.callback(*args, **kwargs)
   1111         return self._style(retval)
   1112 

~\Anaconda3\lib\site-packages\holoviews\core\spaces.py in __call__(self, *args, **kwargs)
    712 
    713         try:
--> 714             ret = self.callable(*args, **kwargs)
    715         except KeyError:
    716             # KeyError is caught separately because it is used to signal

~\Anaconda3\lib\site-packages\holoviews\util\__init__.py in dynamic_operation(*key, **kwargs)
   1041         def dynamic_operation(*key, **kwargs):
   1042             key, obj = resolve(key, kwargs)
-> 1043             return apply(obj, *key, **kwargs)
   1044 
   1045         operation = self.p.operation

~\Anaconda3\lib\site-packages\holoviews\util\__init__.py in apply(element, *key, **kwargs)
   1033         def apply(element, *key, **kwargs):
   1034             kwargs = dict(util.resolve_dependent_kwargs(self.p.kwargs), **kwargs)
-> 1035             processed = self._process(element, key, kwargs)
   1036             if (self.p.link_dataset and isinstance(element, Dataset) and
   1037                 isinstance(processed, Dataset) and processed._dataset is None):

~\Anaconda3\lib\site-packages\holoviews\util\__init__.py in _process(self, element, key, kwargs)
   1015         elif isinstance(self.p.operation, Operation):
   1016             kwargs = {k: v for k, v in kwargs.items() if k in self.p.operation.param}
-> 1017             return self.p.operation.process_element(element, key, **kwargs)
   1018         else:
   1019             return self.p.operation(element, **kwargs)

~\Anaconda3\lib\site-packages\holoviews\core\operation.py in process_element(self, element, key, **params)
    192             self.p = param.ParamOverrides(self, params,
    193                                           allow_extra_keywords=self._allow_extra_keywords)
--> 194         return self._apply(element, key)
    195 
    196 

~\Anaconda3\lib\site-packages\holoviews\core\operation.py in _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

~\Anaconda3\lib\site-packages\holoviews\operation\datashader.py in _process(self, element, key)
   1496 
   1497     def _process(self, element, key=None):
-> 1498         agg = rasterize._process(self, element, key)
   1499         shaded = shade._process(self, agg, key)
   1500         return shaded

~\Anaconda3\lib\site-packages\holoviews\operation\datashader.py in _process(self, element, key)
   1475                                        if k in transform.param})
   1476             op._precomputed = self._precomputed
-> 1477             element = element.map(op, predicate)
   1478             self._precomputed = op._precomputed
   1479 

~\Anaconda3\lib\site-packages\holoviews\core\data\__init__.py in pipelined_fn(*args, **kwargs)
    203 
    204             try:
--> 205                 result = method_fn(*args, **kwargs)
    206                 if PipelineMeta.disable:
    207                     return result

~\Anaconda3\lib\site-packages\holoviews\core\data\__init__.py in map(self, *args, **kwargs)
   1220 
   1221     def map(self, *args, **kwargs):
-> 1222         return super(Dataset, self).map(*args, **kwargs)
   1223     map.__doc__ = LabelledData.map.__doc__
   1224 

~\Anaconda3\lib\site-packages\holoviews\core\dimension.py in map(self, map_fn, specs, clone)
    708             return deep_mapped
    709         else:
--> 710             return map_fn(self) if applies else self
    711 
    712 

~\Anaconda3\lib\site-packages\holoviews\core\operation.py in __call__(self, element, **kwargs)
    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

~\Anaconda3\lib\site-packages\holoviews\core\operation.py in _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

~\Anaconda3\lib\site-packages\holoviews\operation\datashader.py in _process(self, element, key)
    468 
    469         dfdata = PandasInterface.as_dframe(data)
--> 470         agg = getattr(cvs, glyph)(dfdata, x.name, y.name, agg_fn)
    471         if 'x_axis' in agg.coords and 'y_axis' in agg.coords:
    472             agg = agg.rename({'x_axis': x, 'y_axis': y})

~\Anaconda3\lib\site-packages\datashader\core.py in line(self, source, x, y, agg, axis, geometry, antialias)
    403                            format(agg))
    404                 warnings.warn(message)
--> 405         return bypixel(source, self, glyph, agg)
    406 
    407     def area(self, source, x, y, agg=None, axis=0, y_stack=None):

~\Anaconda3\lib\site-packages\datashader\core.py in bypixel(source, canvas, glyph, agg)
   1211     with np.warnings.catch_warnings():
   1212         np.warnings.filterwarnings('ignore', r'All-NaN (slice|axis) encountered')
-> 1213         return bypixel.pipeline(source, schema, canvas, glyph, agg)
   1214 
   1215 

~\Anaconda3\lib\site-packages\datashader\utils.py in __call__(self, head, *rest, **kwargs)
    107         typ = type(head)
    108         if typ in lk:
--> 109             return lk[typ](head, *rest, **kwargs)
    110         for cls in getmro(typ)[1:]:
    111             if cls in lk:

~\Anaconda3\lib\site-packages\datashader\data_libraries\pandas.py in pandas_pipeline(df, schema, canvas, glyph, summary)
     15 @bypixel.pipeline.register(pd.DataFrame)
     16 def pandas_pipeline(df, schema, canvas, glyph, summary):
---> 17     return glyph_dispatch(glyph, df, schema, canvas, summary)
     18 
     19 

~\Anaconda3\lib\site-packages\datashader\utils.py in __call__(self, head, *rest, **kwargs)
    110         for cls in getmro(typ)[1:]:
    111             if cls in lk:
--> 112                 return lk[cls](head, *rest, **kwargs)
    113         raise TypeError("No dispatch for {0} type".format(typ))
    114 

~\Anaconda3\lib\site-packages\datashader\data_libraries\pandas.py in default(glyph, source, schema, canvas, summary, cuda)
     43 
     44     bases = create((height, width))
---> 45     extend(bases, source, x_st + y_st, x_range + y_range)
     46 
     47     return finalize(bases,

~\Anaconda3\lib\site-packages\datashader\glyphs\line.py in extend(aggs, df, vt, bounds, plot_start)
     71             do_extend(
     72                 sx, tx, sy, ty, xmin, xmax, ymin, ymax,
---> 73                 xs, ys, plot_start, *aggs_and_cols
     74             )
     75 

~\Anaconda3\lib\site-packages\numba\dispatcher.py in _compile_for_args(self, *args, **kws)
    399                 e.patch_message(msg)
    400 
--> 401             error_rewrite(e, 'typing')
    402         except errors.UnsupportedError as e:
    403             # Something unsupported is present in the user code, add help info

~\Anaconda3\lib\site-packages\numba\dispatcher.py in error_rewrite(e, issue_type)
    342                 raise e
    343             else:
--> 344                 reraise(type(e), e, None)
    345 
    346         argtypes = []

~\Anaconda3\lib\site-packages\numba\six.py in reraise(tp, value, tb)
    666             value = tp()
    667         if value.__traceback__ is not tb:
--> 668             raise value.with_traceback(tb)
    669         raise value
    670 

TypingError: Failed in nopython mode pipeline (step: nopython frontend)
Failed in nopython mode pipeline (step: nopython frontend)
Failed in nopython mode pipeline (step: nopython frontend)
Failed in nopython mode pipeline (step: nopython frontend)
Internal error at <numba.typeinfer.StaticGetItemConstraint object at 0x0000021D40ACEC88>.
tuple index out of range
[1] During: typing of static-get-item at C:\Users\HornLab\Anaconda3\lib\site-packages\datashader\glyphs\line.py (653)
Enable logging at debug level for details.

File "..\..\..\Anaconda3\lib\site-packages\datashader\glyphs\line.py", line 653:
def _xiaolinwu(i, x0, x1, y0, y1, append, *aggs_and_cols):
    <source elided>
    agg = aggs_and_cols[0]
    cols = aggs_and_cols[1]
    ^

[1] During: resolving callee type: type(CPUDispatcher(<function _xiaolinwu at 0x0000021D2E0B98B8>))
[2] During: typing of call at <draw_segment> (33)

[3] During: resolving callee type: type(CPUDispatcher(<function _xiaolinwu at 0x0000021D2E0B98B8>))
[4] During: typing of call at <draw_segment> (33)


File "<draw_segment>", line 33:
<source missing, REPL/exec in use?>

[1] During: resolving callee type: type(CPUDispatcher(<function draw_segment at 0x0000021D4063DAF8>))
[2] During: typing of call at <perform_extend_line> (13)

[3] During: resolving callee type: type(CPUDispatcher(<function draw_segment at 0x0000021D4063DAF8>))
[4] During: typing of call at <perform_extend_line> (13)


File "<perform_extend_line>", line 13:
<source missing, REPL/exec in use?>

[1] During: resolving callee type: type(CPUDispatcher(<function perform_extend_line at 0x0000021D4063DE58>))
[2] During: typing of call at <extend_cpu> (10)

[3] During: resolving callee type: type(CPUDispatcher(<function perform_extend_line at 0x0000021D4063DE58>))
[4] During: typing of call at <extend_cpu> (10)


File "<extend_cpu>", line 10:
<source missing, REPL/exec in use?>

如果我删除“datashade”线并仅绘制 Holoviews 曲线图,那么它工作正常。但如果它是一个 2500 万个点的图,它会花很长时间,因此我需要 Datashader 的原因:

import numpy as np, pandas as pd, holoviews as hv
from holoviews.operation.datashader import datashade
hv.extension('bokeh','matplotlib')

n = 100000
dates = pd.date_range(start='1990-01-01', freq='1T', periods=n)
curve = hv.Curve((dates,
                  np.random.normal(size=(n,)))).opts(width = 1000)
curve

输出图:

关于可能导致此错误的原因有什么想法吗?如果需要,我可以提供任何其他信息。

您的 Datashader 代码在我的系统上运行良好:

也许您有一些旧版本,尤其是 Numba?