我可以使用Pandas pandas.DataFrame.boxplot()方法创建以下箱形图:
import pandas as pd
import numpy as np
np.random.seed(1234)
df = pd.DataFrame(np.random.rand(10, 4),
columns=['Col1', 'Col2', 'Col3', 'Col4'])
df.plot.box()
plt.show()
尽管,如果我尝试使用以Bokeh为后端的HoloViews的BoxWhisker Element进行相同的操作,那么它对于单列也可以正常工作:
import holoviews as hv
from holoviews import opts
hv.extension('bokeh')
hv.BoxWhisker(
data=df['Col1'],
vdims='Col1'
)
但是,当我尝试仅添加另一列时,出现以下错误:
hv.BoxWhisker(
data=df[['Col1', 'Col2']]
)
DataError: None of the available storage backends were able to support the supplied data format. PandasInterface raised following error:
unsupported operand type(s) for +: 'NoneType' and 'int'
PandasInterface expects tabular data, for more information on supported datatypes see http://holoviews.org/user_guide/Tabular_Datasets.html
我不了解HoloViews理解的Tabular Data是否存在问题,或者我无法正确应用语法。
答案 0 :(得分:1)
答案 1 :(得分:1)