Plotly热图与Jupyter笔记本不兼容?

问题描述 投票:1回答:1

我对Plotly有问题。首先我的代码:

data=go.Heatmap(z=z, x=df[numerical].columns.values, y=df[numerical].columns.values, 
                type='heatmap', colorscale = 'Viridis', reversescale = False)

layout = go.Layout(title='Pearson Correlation of numerical features',
                   xaxis = dict(ticks='', nticks=36),
                   yaxis = dict(ticks='' ),
                   width = 900, height = 900)


fig = go.Figure(data=data, layout=layout)
py.iplot(fig, filename='labelled-heatmap')

此代码可以在我的kaggle笔记本中运行,没有任何问题。如果我将此代码导入到我的jupyter笔记本中。我收到以下错误:

 Invalid property specified for object of type plotly.graph_objs.Heatmap: 'type'

删除类型属性时,出现以下错误:

 Invalid value of type 'plotly.graph_objs._heatmap.Heatmap' received for the 'data' property of 
    Received value

由于我对编程还很陌生,我希望这个问题对您来说不会显得愚蠢。但是,您是否知道a)为什么在kaggle笔记本中运行相同的代码时没有任何问题,但是jupyter出现了问题; b)我该怎么办才能解决此问题?

python python-3.x jupyter-notebook plotly kaggle
1个回答
0
投票

[kaggle和您的笔记本电脑上的Plotly版本可能不匹配。

请通过以下方式更新笔记本电脑上的版本:

pip install -U plotly
© www.soinside.com 2019 - 2024. All rights reserved.