Holoview create dataset - typeError: __init__() takes 2 positional arguments but 4 were given

Holoview create dataset - typeError: __init__() takes 2 positional arguments but 4 were given

我正在尝试学习如何使用 holoview 包。

我发现这两个笔记本似乎很有用: https://anaconda.org/jbednar/bednar_index_2017/notebook & http://holoviews.org/getting_started/Tabular_Datasets.html.

但是,我无法创建 hv.dataset,因为出现错误:

typeError: __init__() 接受 2 个位置参数,但给出了 4 个。

import holoviews as hv
hv.extension('bokeh')

vdims = [('complaint_frac', 'frac')]
ds = hv.Dataset(df_plot3, ['ComplaintType', 'hour'], vdims)
measles_by_state = ds.to(hv.Curve, 'hour', 'complaint_frac')
measles_by_state * hv.VLine(1963)

这里是 pandas' 数据框:

任何帮助都会很棒!

编辑:

按要求,错误传单:

 TypeError                                 Traceback (most recent call last)
<ipython-input-59-3491a16b7264> in <module>()
      1 vdims = [('complaint_frac', 'frac')]
----> 2 ds = hv.Dataset(df_plot3, ['hour', 'ComplaintType'], vdims)
      3 measles_by_state = ds.to(hv.Curve, 'hour', 'complaint_frac')
      4 measles_by_state * hv.VLine(1963)
      5 

TypeError: __init__() takes 2 positional arguments but 4 were given

可能是因为您将第二个和第三个参数作为位置参数传递。尝试将它们作为关键字参数传递。

ds = hv.Dataset(df_plot3, kdims=['ComplaintType', 'hour'], vdims=vdims)