kim*_*kim 25 python jupyter-notebook
我正在尝试使用sns.histplotKaggle 的 Jupyter Notebook 中的 Titanic 数据集进行绘图。
这是我的代码:
sns.histplot(train, x = "Age", hue="Sex")
Run Code Online (Sandbox Code Playgroud)
但它给我这个错误:
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-11-d14c3b5a0670> in <module>
----> 1 sns.histplot(train, x = "Age", hue="Sex")
AttributeError: module 'seaborn' has no attribute 'histplot'
Run Code Online (Sandbox Code Playgroud)
我已确保导入 seaborn(以前使用的图sns.barplot工作正常)。
我在 Mac OS X 10.15.6 和 Seaborn 0.11.0 版上运行。
有人可以指出出了什么问题吗?提前致谢。
Ahs*_*eer 29
我使用以下方法更新了 seaborn 模块:
pip install -U seaborn
Run Code Online (Sandbox Code Playgroud)
它为我解决了这个问题。
小智 7
只是为了扩展 Ahsan Goheer 的答案。尝试使用以下命令更新seaborn:
pip install -U seaborn
Run Code Online (Sandbox Code Playgroud)
然后重新启动笔记本的内核。现在应该可以工作了