python - Plotly 热图与 Jupyter 笔记本不兼容?
问题描述
我对 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 notebook 中运行没有任何问题。如果我将此代码导入我的 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 notebook中运行没有任何问题,但是jupyter有问题,b)我能做些什么来解决这个问题?
解决方案
kaggle 和笔记本电脑上的 Plotly 版本可能不匹配。
请通过以下方式更新笔记本电脑上的版本:
pip install -U plotly
推荐阅读
- typescript - 添加到自动完成列表的自动完成项目在保存文件后不显示
- python - 安装 python 包失败,包 'example' 需要不同的 Python: 2.7.12 not in '>=2.5, >=3.0' ,尽管版本应该适合
- types - Rustlings Course Test4.rs 宏返回类型问题
- python - 大型数据集的碰撞处理?
- javascript - 无法获取。单击以在新选项卡中打开
- laravel - Laravel 在 catch 中返回重定向
- jquery - 每次 WooCommerce 更改地址时发送电子邮件
- django - Django:将模型选择字段选项设置为查询集值和其他值
- image - 如何在处理中仅显示图像的一部分?
- android - 通过单击我的应用程序(Kotlin)中的按钮打开与特定联系人的 WhatsApp 聊天