且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Jupyter笔记本中未显示密谋森伯斯特图

更新时间:2023-11-21 15:17:28

我没有特定的解决方案,但是至少在没有您自己的特定数据集的情况下,尽我所能提出了建议.

I don't have a specific solution, but at least a suggestion to the best of my abilities without your particular dataset.

我的第一个怀疑是您没有安装正确的软件包,但是因为您已经声明了

My first suspicion was that you did not have the correct packages installed, but since you've stated that

我都没有为Plotly玩过在线游戏还是离线游戏 似乎有所作为

I have played around with the online vs offline for Plotly neither appeared to make a difference

在我看来,您的问题 是您的数据,特别是 类型 结构 .来自您引荐的示例我尝试用values=['10', '14', '12', '10', '2', '6', '6', '4', '4']替换values=[10, 14, 12, 10, 2, 6, 6, 4, 4],但是效果很好,并增加了导致问题的是结构而不是类型的可能性.

it seems to me that your problem has to be your data, specifically the type or the structure of your data. From your referred example I tried replacing values=[10, 14, 12, 10, 2, 6, 6, 4, 4] with values=['10', '14', '12', '10', '2', '6', '6', '4', '4'], but that worked just fine and increases the probability that it's the structure and not type that causes the problems.

然后我弄乱了结构,将labels=["Eve", "Cain", "Seth", "Enos", "Noam", "Abel", "Awan", "Enoch", "Azura"]替换为 labels=["Eve", "Cain", "Noam", "Abel", "Awan", "Enoch", "Azura"].现在,不会生成任何图,并且不会显示以下错误消息:

Then I messed with the structure, replacing labels=["Eve", "Cain", "Seth", "Enos", "Noam", "Abel", "Awan", "Enoch", "Azura"] with labels=["Eve", "Cain", "Noam", "Abel", "Awan", "Enoch", "Azura"]. Now, no plot is produced with no error messages like this:

我的结论:确保parents中的每个观察结果都出现在labels中.

My conclusion: Make sure that each observation in parents occurs in labels.

labels移除'Noam'是可以的.似乎是因为'Noam'parents中没有出现:

Removing 'Noam' from labels is ok. seemingly because 'Noam' does not occur in parents:

从标签中删除'Seth'是不可行的:

Removing 'Seth' from labels is not ok:

因此,再次确保parents中的每个观察结果都出现在labels中,并查看是否对您有用.

So again, make sure that each observation in parents occurs in labels and see if that works out for you.