[英]Plotly Sunburst - TypeError: sunburst() got an unexpected keyword argument 'path'
[英]treemap() got an unexpected keyword argument 'path' in plotly.express
statewise_cases["Country"] = "Country"
print(statewise_cases)
fig = px.treemap(statewise_cases, path = ['Country', 'State'], values='Deaths')
fig.show()
升级plotly
为我解决了这个问题: pip install --upgrade plotly
。 我之前的版本是4.4.1,我升级到了4.7.1。 也许这是旧版本plotly
的问题。
(Just in case you're interested in checking your plotly
version: px.__version__
doesn't work because plotly
does not have a __version__
property. I used pip freeze
to list all my packages and their versions, and checked the plotly
version from there )。
plotly.graph_objects.Treemap
没有关键字参数path
。 这就是错误消息所说的。 虽然它有pathbar
,但它应该是 dict。
另一方面, plotly.express.treemap
将路径作为参数。
我最好的选择是你已经导入了另一个你认为你正在使用的库。
问题是Plotly的版本,通过更新即可解决。
谷歌 Colab:
!pip install --upgrade plotly
Windows:
pip 安装--升级 plotly
Linux:
pip3安装--升级plotly
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.